javascripts/shuriken/mixins/callbacks.js in shuriken-0.1.3.1 vs javascripts/shuriken/mixins/callbacks.js in shuriken-0.1.4

- old
+ new

@@ -1,40 +1,42 @@ var __slice = Array.prototype.slice; Shuriken.defineExtension(function(baseNS) { return baseNS.defineMixin('Callbacks', function(mixin) { mixin.callbacks = {}; - mixin.defineCallback = function defineCallback(key) { + mixin.defineCallback = function(key) { this[("on" + key)] = function(callback) { return this.hasCallback(key, callback); }; this[("invoke" + key)] = function() { var args; - args = __slice.call(arguments, 0, arguments.length - 0); + var _a = arguments.length, _b = _a >= 1; + args = __slice.call(arguments, 0, _a - 0); return this.invokeCallbacks.apply(this, [key].concat(args)); }; return true; }; - mixin.hasCallback = function hasCallback(name, callback) { + mixin.hasCallback = function(name, callback) { var _a, callbacks; callbacks = mixin.callbacks[name] = (typeof (_a = mixin.callbacks[name]) !== "undefined" && _a !== null) ? mixin.callbacks[name] : []; callbacks.push(callback); return true; }; - mixin.callbacksFor = function callbacksFor(name) { + mixin.callbacksFor = function(name) { var existing; existing = mixin.callbacks[name]; if ((typeof existing !== "undefined" && existing !== null)) { return existing; } else { return []; } }; - mixin.invokeCallbacks = function invokeCallbacks(name) { - var _a, _b, _c, args, callback; - args = __slice.call(arguments, 1, arguments.length - 0); - _b = mixin.callbacksFor(name); - for (_a = 0, _c = _b.length; _a < _c; _a++) { - callback = _b[_a]; + mixin.invokeCallbacks = function(name) { + var _c, _d, _e, args, callback; + var _a = arguments.length, _b = _a >= 2; + args = __slice.call(arguments, 1, _a - 0); + _d = mixin.callbacksFor(name); + for (_c = 0, _e = _d.length; _c < _e; _c++) { + callback = _d[_c]; if (callback.apply(this, args) === false) { return false; } } return true; \ No newline at end of file