messageHandler update
This commit is contained in:
parent
8ad64ac523
commit
7f39d3dcdd
|
|
@ -22,9 +22,7 @@
|
||||||
$('.toast-info').css("background-color", "#008080");
|
$('.toast-info').css("background-color", "#008080");
|
||||||
},
|
},
|
||||||
bidNotification: function (data) {
|
bidNotification: function (data) {
|
||||||
//console.log("Bid product name" + data.productName);
|
|
||||||
toastr.success(`<div class="item bidToast"><p>${data.bidPrice}</p><p>${data.productName}</p></div>`, "New bid arrived", {
|
toastr.success(`<div class="item bidToast"><p>${data.bidPrice}</p><p>${data.productName}</p></div>`, "New bid arrived", {
|
||||||
//"timeOut": 150000,
|
|
||||||
"closeButton": true,
|
"closeButton": true,
|
||||||
"positionClass": "toast-bottom-right",
|
"positionClass": "toast-bottom-right",
|
||||||
"newestOnTop": true,
|
"newestOnTop": true,
|
||||||
|
|
@ -39,10 +37,18 @@
|
||||||
"hideEasing": "linear",
|
"hideEasing": "linear",
|
||||||
"showMethod": animation,
|
"showMethod": animation,
|
||||||
"hideMethod": "fadeOut"
|
"hideMethod": "fadeOut"
|
||||||
|
|
||||||
});
|
});
|
||||||
$('.toast-success').css("background-color", "#4caf50");
|
$('.toast-success').css("background-color", "#4caf50");
|
||||||
},
|
},
|
||||||
|
auctionUpdate: function (data) {
|
||||||
|
const widgetPriceElement = document.getElementById("WidgetPrice");
|
||||||
|
if (widgetPriceElement) {
|
||||||
|
widgetPriceElement.textContent = data.bidPrice; // Update the price
|
||||||
|
console.log(`WidgetPrice updated to: ${data.bidPrice}`);
|
||||||
|
} else {
|
||||||
|
console.warn("Element with ID 'WidgetPrice' not found in the DOM.");
|
||||||
|
}
|
||||||
|
},
|
||||||
// Add more handlers as needed
|
// Add more handlers as needed
|
||||||
default: function (data) {
|
default: function (data) {
|
||||||
console.warn("Unhandled message type:", data);
|
console.warn("Unhandled message type:", data);
|
||||||
|
|
@ -53,7 +59,6 @@
|
||||||
function messageRouter(message) {
|
function messageRouter(message) {
|
||||||
// Parse the JSON message
|
// Parse the JSON message
|
||||||
try {
|
try {
|
||||||
/*console.log(message);*/
|
|
||||||
const parsedMessage = JSON.parse(message);
|
const parsedMessage = JSON.parse(message);
|
||||||
const messageType = parsedMessage.messageType;
|
const messageType = parsedMessage.messageType;
|
||||||
const messageData = parsedMessage.data;
|
const messageData = parsedMessage.data;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue