kontrol
v0.0.1
Published
Make easier the use of events
Downloads
18
Readme
#kontrol
Kontrol es una libreria con la que se pretende facilitar el uso de eventos
dentro de cualquier aplicación hecha en node.
//app.js
kontrol = require('kontrol');
var eG = kontrol.emisorGlobal;
eG.on( 'moduloCargado' , function(tiempo){
console.log('Un modulo ha sido cargado después de',tiempo,'milesimas '+
'de segundo');
});
var modulo = require('./unModulo.js');
//unModulo.js
var eG = kontrol.emisorGlobal;
var tiempo = 3000;
setTimeout(function(){
eG.emit('moduloCargado',tiempo);
},tiempo);
##Estructura
kontrol
util : object
Fecha : constructor function
LogEventos : constructor function
Respuesta : constructor function
Peticion : constructor function
emisores : object
Emisor : constructor function
emisorGlobal : EventEmitter : Emisor
nuevoEmisor : EventEmitter : Emisor
distribuidor : object
nuevoEmisor : function
nuevoEventoTemporal : function
##Util
Este objeto contiene un conjunto de herramientas ya sea para usar con
kontrol o sin dicha libreria.
##util.Fecha
Es un objeto que provee la fecha del momento en el que es creado, al cual
se le puede establecer una zonaHoraria.
La fecha en formato ISO Date de tal objeto se obtiene mediante el atributo date.
//fechaHoraria.js
kontrol = require('kontrol');
var Fecha = kontrol.util.Fecha,
fechaInglaterra = new Fecha(),
fechaMexico = new Fecha();
//Con la siguiente linea se le dice que obtenga la hora central de Mexico
fechaMexico.setZonaHoraria(-6);
console.log('Fecha Inglaterra:',fechaInglaterra.date);
console.log('Fecha Mexico:',fechaMexico.date);
##util.LogEventos