ForgeComponentes
es

Componentes

j-Notifications

jComponent 20 · jcomponent@20 component Ejemplo cargado con jComponent 20
  • singleton

Configuración:

  • date {String} un formato de fecha (predeterminado yyyy-MM-dd HH:mm)
  • timeout {Número} debe contener un tiempo de espera (milisegundos) para el vencimiento de la notificación (predeterminado: 8000)
  • native {Booleano} habilita notificaciones nativas cuando la ventana no está enfocada (predeterminado: false)

Métodos

  • component.append(icon, message, [datetime], [callback], [color]) por crear una nueva notificación

Úselo con <ui-component name="notifications">. Cuando el componente aún no está cargado, jComponent lo descarga en el primer uso desde la dirección en DEF.fallback (la CDN Componentator de forma predeterminada). Autor: Peter Širka. Fuente: repositorio de componentes Componentator, licencia 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>