Skip to content

xaliphostes/microevent.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MicroEvent in ES6+

Refactor of MicroEvent in JavaScript for ES6+

Usage

See this page

Example

 import MicroEvent from 'MicroEvent'
 
 class Ticker {
     constructor() {
         setInterval( () => {
             this.trigger( 'tick', new Date() )
         }, 1000)
     }
 }
 MicroEvent.mixin(Ticker)
 
  
 const ticker = new Ticker()
 ticker.bind('tick', date => {
     console.log('notified date', date)
 })
  
 // And you will see this output every second:
 //   notified date Tue, 22 Mar 2019 14:43:41 GMT
 //   notified date Tue, 22 Mar 2019 14:43:42 GMT
 //   ...

About

Refactor of MicroEvent for ES6+

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors