0.1.1 • Published 8 years ago

reportable v0.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

reportable

A simple alternative to event emitters, but with the "safety" that you are binding to events that will actually be sent.

usage example

import reportable from 'reportable'

class Something {
  constructor() {
    reportable(this, [
      'start',
      'success',
      'failure',
    ])
  }

  getGoing() {
    this.report.start()
  }
}

// later on, maybe in another file

const something = new Something();
something.consumeReports({
  start() {
    console.log('something has started')
  }
})

something.getGoing() // logs "something has started"