const EventEmitter = require('eventemitter2')
const store = require('../store/store')

const events = new EventEmitter()
const ready = store.subscribe(onReady)

function select(state) {
  return state.globals.authenticated
}

function onReady () {
  const isReady = select(store.getState())
  if (isReady) events.emit('onReady')
}

module.exports = events

@@ -124,13 +124,14 @@
 nst 
-ready
+handle
  = s
@@ -149,185 +149,510 @@
 ibe(
-onReady)%0A%0Afunction select(state) %7B%0A  return state.globals.authenticated%0A%7D%0A%0Afunction onReady () %7B%0A  const isReady = select(store.getState())%0A  if (isReady) events.emit('onReady')
+handleEvent)%0A%0Aconst authenticated = (state) =%3E state.globals.authenticated%0Aconst hasDocumentCaptured = (state) =%3E state.globals.hasDocumentCaptured%0Aconst hasFaceCaptured = (state) =%3E state.globals.hasFaceCaptured%0A%0Afunction handleEvent () %7B%0A  const state = store.getState()%0A  console.log(state.globals)%0A  if (authenticated(state)) %7B%0A    events.emit('ready')%0A  %7D%0A  if (hasDocumentCaptured(state)) %7B%0A    events.emit('documentCapture')%0A  %7D%0A  if (hasFaceCaptured(state)) %7B%0A    events.emit('faceCapture')%0A  %7D
 %0A%7D%0A%0A

Add events handler to provide plugin callbacks