Sha256: 06850ad0612e83bcb7f6c7dcce8ff5714fa31778d386410611c4c14be06fd3fb
Contents?: true
Size: 695 Bytes
Versions: 1
Compression:
Stored size: 695 Bytes
Contents
Shuriken.defineExtension (baseNS) -> baseNS.defineMixin 'Callbacks', (mixin) -> mixin.callbacks = {} mixin.defineCallback = (key) -> @["on#{key}"] = (callback) -> @hasCallback key, callback @["invoke#{key}"] = (args...) -> @invokeCallbacks key, args... true mixin.hasCallback = (name, callback) -> callbacks = mixin.callbacks[name]?= [] callbacks.push callback true mixin.callbacksFor = (name) -> existing = mixin.callbacks[name] if existing? then existing else [] mixin.invokeCallbacks = (name, args...) -> for callback in mixin.callbacksFor(name) return false if callback(args...) is false true
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shuriken-0.2.1 | coffeescripts/shuriken/mixins/callbacks.coffee |