Sha256: a8df013af8c6f44fd3cd0510499e5ec80e8f9a710663ec51b5ef69687d2b6de3

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

Luca.concerns.CollectionEventBindings = 
  __initializer: ()->
    return if _.isEmpty( @collectionEvents )

    manager = @collectionManager || Luca.CollectionManager.get()

    for signature, handler of @collectionEvents
      [key,eventTrigger] = signature.split(" ")

      collection = manager.getOrCreate( key )

      if !collection
        throw "Could not find collection specified by #{ key }"

      if _.isString(handler)
        handler = @[handler]

      unless _.isFunction(handler)
        throw "invalid collectionEvents configuration"

      try
        collection.on(eventTrigger, handler, collection)
      catch e
        console.log "Error Binding To Collection in registerCollectionEvents", @
        throw e

Version data entries

2 entries across 2 versions & 1 rubygems

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