tmitter
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

tMitter

minimalistic emitter-system in Javascript, learn maximal 4 method, that you might already know from backbone.events or Emitter.js

var emitter = tmitter();
emitter.on(function(argument){
  console.log('b has updated');
});
emitter.trigger( argument);
 

new: now in typescript.

interace IEvent{
  somestring;
}
 
const emitter = tmitter<IEvent>();
emitter.on(arg  => {
  console.log(arg.some); // arg.some is known as a string
});
 
emitter.trigger({ some: 'Tobias' }); // TS require an object with a string attribute some.
 

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i tmitter

      Weekly Downloads

      18

      Version

      3.0.3

      License

      MIT

      Unpacked Size

      3.99 kB

      Total Files

      6

      Last publish

      Collaborators

      • nickeltobias