Sha256: 239df233c2ae1ae73e1afbabbe88956f2194cf26995be0af65a58e047b9e6bf3
Contents?: true
Size: 1.25 KB
Versions: 30
Compression:
Stored size: 1.25 KB
Contents
(function() { var __slice = Array.prototype.slice; Luca.Observer = (function() { function Observer(options) { var _this = this; this.options = options != null ? options : {}; _.extend(this, Backbone.Events); this.type = this.options.type; if (this.options.debugAll) { this.bind("event", function() { var args, t; t = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; return console.log("Observed " + _this.type + " " + (t.name || t.id || t.cid), t, _(args).flatten()); }); } } Observer.prototype.relay = function() { var args, triggerer; triggerer = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; this.trigger("event", triggerer, args); return this.trigger("event:" + args[0], triggerer, args.slice(1)); }; return Observer; })(); Luca.Observer.enableObservers = function(options) { if (options == null) options = {}; Luca.enableGlobalObserver = true; Luca.ViewObserver = new Luca.Observer(_.extend(options, { type: "view" })); return Luca.CollectionObserver = new Luca.Observer(_.extend(options, { type: "collection" })); }; }).call(this);
Version data entries
30 entries across 30 versions & 1 rubygems