Mango.Nop.Plugins/Nop.Plugin.Misc.AuctionPlugin/Content/Js/LiveAnnouncement.js

120 lines
2.8 KiB
JavaScript

// Define the message handler library
// SignalR connection setup
$(function () {
console.log("signalRJs Starts");
var connection = new signalR.HubConnectionBuilder()
.withUrl('/auctionhub')
.build();
connection.on('send', data => {
MessageHandler.handle(data);
});
function start() {
connection.start().catch(function (err) {
setTimeout(function () {
start();
}, 100000);
});
}
connection.onclose(function () {
start();
});
start();
});
//$(function () {
// console.log("signalRJs Starts");
// var connection = new signalR.HubConnectionBuilder()
// .withUrl('/auctionhub')
// .build();
// connection.on('send', data => {
// showannouncement(data);
// });
// function start() {
// connection.start().catch(function (err) {
// setTimeout(function () {
// start();
// }, 100000);
// });
// }
// connection.onclose(function () {
// start();
// });
// start();
//});
//function showannouncement(announcemant) {
// console.log("announcement arrived!");
// if (announcemant) {
// toastr.options = {
// "closeButton": true,
// "debug": false,
// "newestOnTop": false,
// "progressBar": false,
// "positionClass": "toast-bottom-right",
// "preventDuplicates": false,
// "onclick": null,
// "showDuration": 300,
// "hideDuration": 10000,
// "timeOut": 100000,
// "extendedTimeOut": 20000,
// "showEasing": "swing",
// "hideEasing": "linear",
// "showMethod": "fadeIn",
// "hideMethod": "fadeOut"
// };
// tostView = '<div class="item announcemantToast">' + announcemant + '</div>'
// toastr["info"](tostView);
// $('.toast-info').css("background-color", "#008080");
// toastr.options.onclick = function () {
// $("html, body").animate(
// { scrollTop: 0 },
// 1000);
// }
// $(".toast").click(function () {
// $("html, body").animate(
// { scrollTop: 0 },
// 1000);
// });
// $(".toast-info").click(function () {
// $("html, body").animate(
// { scrollTop: 0 },
// 1000);
// });
// toastr.options = {
// onclick: function () {
// $("html, body").animate(
// { scrollTop: 0 },
// 1000);
// }
// }
// $(".announcemantToast").on("click", function () {
// $("html, body").animate(
// { scrollTop: 0 },
// 1000);
// });
// }
//}