ForgeKomponenty
sk

Komponenty

j-NotificationsPanel

jComponent 20 · jcomponent@20 component Príklad načítaný s jComponent 20
  • singleton
  • poučiť sa z príkladu

Konfigurácia:

  • top {Number} horný posun (predvolené: 0)
  • visibleY {Boolean} zobrazuje posuvníky Y (predvolené: true)
  • Názov title {String} v paneli upozornení (predvolené: Notifications)
  • autoremove {Boolean} odstráni upozornenia po kliknutí naň (predvolené: true)
  • click {String} cesta k metóde function(obj, el), keď používateľ klikne na upozornenia
  • exec {String} cesta k metóde function(render(ARR_OF_OBJECT)), keď chce používateľ zobraziť upozornenia

Použite ho so <ui-component name="notificationspanel">. Keď komponent ešte nie je načítaný, jComponent ho stiahne pri prvom použití z adresy v DEF.fallback (predvolene CDN Componentator). Autor: Peter Širka. Zdroj: úložisko komponentov Componentator, licencia MIT.

example.html
<ui-component name="notificationspanel" path="shownotifications" config="exec:loadnotifications;click:clicknotificiation">
	<script type="text/html">
		<h2>{{ name }}</h2>
		<p>{{ body }}</p>
		<hr />
	</script>
</ui-component>

<script>

	var shownotifications = false;

	// Shows notifications panel after 2 seconds
	SET('shownotifications', true, 2000);

	// The method will be executed automatically before the notifications panel will be visible
	function loadnotifications(render) {
		var arr = [];
		arr.push({ name: 'Name of notifications 1', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
		arr.push({ name: 'Name of notifications 2', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
		arr.push({ name: 'Name of notifications 3', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });

		// IMPORTANT:
		// This renders notifications onto notifications panel
		render(arr);
	}

	function clicknotificiation(obj) {
		console.log('CLICK', obj);
	}

</script>