UNPKG

@unaxiom/unnotify

Version:

Pure JS growlish notifications with zero dependencies, simple API written in TypeScript.

103 lines (90 loc) 3.2 kB
<!DOCTYPE HTML> <html> <head> <title>Unnotify Example</title> <link rel="stylesheet" href="node_modules/animate.css/animate.min.css"> </head> <body> <h1>This is the example HTML file for running unnotify examples.</h1> </body> <script type="text/javascript" src="dist/unnotify.min.js"></script> <script type="text/javascript"> function clickedConfirm(evt, id) { evt.preventDefault(); console.log("Clicked confirm with notification ID: "+id); } function clickedCancel(evt, id) { evt.preventDefault(); console.log("Clicked cancel with notification ID: "+id); } function clickedYes(evt, id) { evt.preventDefault(); console.log("Clicked yes with notification ID: "+id); } function clickedNo(evt, id) { evt.preventDefault(); console.log("Clicked no with notification ID: "+id); } function nextCallback(evt, id, valueEntered) { evt.preventDefault(); console.log("Clicked Next with the following content: ", valueEntered); } window.addEventListener('load', function () { var left = new unnotify.Unnotify('right', true); let temp = left.show("Hi", "From right", { timeout: 0, type: 'info', animateIn: 'fadeInUpBig', animateOut: 'rotateOutDownLeft' }); setTimeout(function () { left.destroy(temp); }, 8000); left.show("Hi", "From right", { timeout: 5000, type: 'danger', animateIn: 'fadeInUpBig', animateOut: 'rotateOutDownLeft' }); left.confirm("Confirm this content, and check the console", { type: "warning", animateIn: "fadeInUpBig", animateOut: "rotateOutDownLeft" }, clickedConfirm, clickedCancel); left.confirm("Confirm this content, and check the console", { type: "info", animateIn: "fadeInUpBig", animateOut: "rotateOutDownLeft" }, clickedConfirm, clickedCancel); left.affirm("Affirm this content, and check the console", { type: "info", animateIn: "fadeInUpBig", animateOut: "rotateOutDownLeft" }, clickedYes, clickedNo); var l = ["info", "warning", "success", "danger"]; for (var i = 0; i < l.length; i++) { var t = l[i]; left.input("This is a message -> enter some content in the input below:", { type: t, animateIn: "fadeInUpBig", animateOut: "rotateOutDownLeft" }, nextCallback, clickedCancel); } // var right = new unnotify.Unnotify('right'); // right.show("Hi", "From right", { // timeout: 4000, // type: 'success' // }); unnotify.init('left'); var a = unnotify.show("Hi", "From normal (left)", { timeout: 0, type: 'success', animateIn: 'fadeInRight', animateOut: 'zoomOutUp' }); setTimeout(function () { unnotify.destroy(a); }, 4000); }); </script> </html>