ForgeKomponenty
pl

Komponenty

j-Notifications

jComponent 20 · jcomponent@20 component Przykład załadowany z jComponent 20
  • Singleton

Konfiguracja:

  • date {String} format daty (default yyyy-MM-dd HH:mm)
  • timeout {Liczba} musi zawierać czas wygaśnięcia (milisekundy) do upływu powiadomienia (default: 8000)
  • native {Boolean} umożliwia notyfikacje pochodzenia, gdy okno nie jest skoncentrowane (default: false)

Metody

  • component.append(icon, message, [datetime], [callback], [color]) do tworzenia nowej notyfikacji

Użyj go z <ui-component name="notifications">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

example.html
<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>