"use strict"

var connection = new signalR.HubConnectionBuilder().withUrl("/ReportCompletedHub").build();
connection.start().then(function () {
		// actions
	}).catch(function (err) {
	return console.error(err.toString());
});


// Notification functionality in browser
if (!("Notification" in window)) {
		alert("This browser does not support desktop notification");
}

else if (Notification.permission === "granted") {
	connection.on("CompletedAsync", function (message) {
			var img = $("#notificationIconDx").val();
			var text = message;
			var notification = new Notification('Report generation has been completed', { body: text, icon: img });
		});
}

else if (Notification.permission !== "denied") {
		Notification.requestPermission();
}