on

function
 on() 

Option name Type Description
eventName String

Name of event, one of listed above

handler Function

callback for event

add a listener to an event

Supported events:

  • add → (object, options)
  • update → (object, options)
  • remove → (object, options)
  • change → (eventName, object, options)
function on (state, eventName, handler) {
  state.emitter.on(eventName, handler)

  return this
}