Sha256: c0e242371d8eb133f29954806df0e5c271977bbe80adbb206eba1c0729bb75f8

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

Luca.concerns.ApplicationEventBindings = 
  __initializer: ()->
    return if _.isEmpty(@applicationEvents)

    app = @app

    if _.isString( app ) or _.isUndefined( app )
      app = Luca.Application?.get?(app)

    unless Luca.supportsEvents( app )
      throw "Error binding to the application object on #{ @name || @cid }"

    for eventTrigger, handler in @applicationEvents
      handler = @[handler] if _.isString(handler) 

      unless _.isFunction(handler)
        throw "Error registering application event #{ eventTrigger } on #{ @name || @cid }"

      app.on(eventTrigger, handler)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
luca-0.9.76 src/concerns/application_event_bindings.coffee
luca-0.9.7 src/concerns/application_event_bindings.coffee