Advertisement
HenX

SignalR

Dec 8th, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var SUZCT = SUZCT || {};
  2.     SUZCT.NotificationManager = SUZCT.NotificationManager || {};
  3.  
  4.     document.addEventListener('DOMContentLoaded', function () {
  5.         if (Notification.permission !== "granted")
  6.             Notification.requestPermission();
  7.     });
  8.  
  9.     $(document).ready(function () {  
  10.         SUZCT.NotificationManager.Hub = $.connection.notificationsHub;
  11.  
  12.         $.connection.hub.start();
  13.      
  14.         SUZCT.NotificationManager.Hub.client.SendNotification = function (message) {
  15.             if (Notification.permission !== "granted") {
  16.                 Notification.requestPermission();                
  17.             }
  18.             else {
  19.                 var notification = new Notification('SÚZ Český Těšín', {
  20.                     icon: '@Href("~/Images/logo_margin.png")',
  21.                     body: message,
  22.                 });
  23.  
  24.                 notification.onclick = function () {
  25.                     window.open("http://www.suzct.cz");
  26.                 };
  27.             };
  28.         };
  29.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement