j-Notifications
- Singleton
Konfiguration:
date{String} ein Datumsformat (Standardyyyy-MM-dd HH:mm)timeout{Number} muss ein Timeout (Millisekunden) für den Ablauf der Benachrichtigung enthalten (Standard:8000)native{Boolean} aktiviert native Benachrichtigungen, wenn das Fenster nicht fokussiert ist (Standard:false)
Methoden
component.append(icon, message, [datetime], [callback], [color])zum Erstellen einer neuen Benachrichtigung
Verwenden Sie es mit <ui-component name="notifications">. Wenn die Komponente noch nicht geladen ist, lädt jComponent sie bei der ersten Verwendung von der Adresse in DEF.fallback herunter (standardmäßig das CDN Componentator). Autor: Peter Širka. Quelle: Componentator-Komponenten-Repository, MIT-Lizenz.
<style>
body { font-family: Arial; background-color: #F5F5F5; }
</style>
<ui-component name="notifications" config="date:dd.MM.yyyy HH:mm;native:true"></ui-component>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia harum accusamus debitis aut sunt, deserunt magni alias neque unde reprehenderit ipsa ea laboriosam eveniet! Distinctio pariatur sed, a aut nobis.
<script>
FIND('notifications', function(component) {
component.append('ti-lightbulb', 'This is a new notification component.');
});
setTimeout(function() {
FIND('notifications').append('ti-calendar', 'You have a meeting in the Central Park.', function() {
alert('You clicked on the notification');
}, 'red');
}, 3000);
setTimeout(function() {
FIND('notifications').append('ti-github', 'Please support <a href="https://github.com/petersirka/jComponent" target="_blank">jComponent on GitHub</a>.');
}, 6000);
setTimeout(function() {
FIND('notifications').append('ti-link', 'Total.js is node.js web application framework, please support it on social networks.');
}, 10000);
</script>