   Pool.run('track', hull)
 
   # Execute Hull.init callback
-  readyDfd.resolve {hull, me, app, org}
+  ready.resolve {hull, me, app, org}
 
   EventBus.emit('hull.ready', hull, me, app, org)
   EventBus.emit('hull.init', hull, me, app, org)


require './utils/console-shim'

# Wraps the success callback
# * Extends the global object
# * Reinjects events in the live app from the pool
# * Replays the track events
onInitSuccess = (userSuccessCallback, _hull, data)->
  userSuccessCallback = userSuccessCallback || ->
  hull = _hull
  {me, app, org} = data

  embeds.initialize({ org });

# Wraps init failure
onInitFailure = (err)-> throw err

###*
 * Main Hull Entry Point
 *
 * Will only be executed once.
 * @param  {[type]} config={}         [description]
 * @param  {[type]} userSuccessCallback [description]
 * @param  {[type]} userFailureCallback [description]
 * @return {[type]}                     [description]
###
init = (config={}, userSuccessCallback, userFailureCallback)->
  if !!hull._initialized
    throw new Error('Hull.init can be called only once')
