author | Giulio Cesare Solaroli <giulio.cesare@solaroli.it> | 2012-03-17 21:18:52 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@solaroli.it> | 2012-03-17 21:18:52 (UTC) |
commit | 288b8df03a499a2e68ebaad48e687d1eac9df0ff (patch) (side-by-side diff) | |
tree | 1fcaefffee8366b548465a05a6c4cba0c31e131d /frontend/gamma/js/MochiKit/Signal.js | |
parent | 6f7ead0446aae6dd9f40b183e402b059a33d0517 (diff) | |
parent | 25029b943781850c76fbf43827af0204f35a98bf (diff) | |
download | clipperz-288b8df03a499a2e68ebaad48e687d1eac9df0ff.zip clipperz-288b8df03a499a2e68ebaad48e687d1eac9df0ff.tar.gz clipperz-288b8df03a499a2e68ebaad48e687d1eac9df0ff.tar.bz2 |
Merge pull request #34 from gcsolaroli/master
Fixed some resources
Diffstat (limited to 'frontend/gamma/js/MochiKit/Signal.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/Signal.js | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/frontend/gamma/js/MochiKit/Signal.js b/frontend/gamma/js/MochiKit/Signal.js index 7df5619..11590c1 100644 --- a/frontend/gamma/js/MochiKit/Signal.js +++ b/frontend/gamma/js/MochiKit/Signal.js @@ -10,3 +10,3 @@ See <http://mochikit.com/> for documentation, downloads, license, etc. -MochiKit.Base._module('Signal', '1.5', ['Base', 'DOM', 'Style']); +MochiKit.Base.module(MochiKit, 'Signal', '1.5', ['Base', 'DOM']); @@ -268,2 +268,3 @@ MochiKit.Base.update(MochiKit.Signal.Event.prototype, { this.type().indexOf('mouse') === 0 || + this.type().indexOf('drag') === 0 || this.type().indexOf('click') != -1 || @@ -271,3 +272,3 @@ MochiKit.Base.update(MochiKit.Signal.Event.prototype, { - m.client = new MochiKit.Style.Coordinates(0, 0); + m.client = { x: 0, y: 0 }; if (e.clientX || e.clientY) { @@ -277,3 +278,3 @@ MochiKit.Base.update(MochiKit.Signal.Event.prototype, { - m.page = new MochiKit.Style.Coordinates(0, 0); + m.page = { x: 0, y: 0 }; if (e.pageX || e.pageY) { @@ -339,3 +340,3 @@ MochiKit.Base.update(MochiKit.Signal.Event.prototype, { if (this.type() == 'mousewheel') { - m.wheel = new MochiKit.Style.Coordinates(0, 0); + m.wheel = { x: 0, y: 0 }; if (e.wheelDeltaX || e.wheelDeltaY) { @@ -674,2 +675,14 @@ MochiKit.Base.update(MochiKit.Signal, { + /** @id MochiKit.Signal.connectOnce */ + connectOnce: function (src, sig, objOrFunc/* optional */, funcOrStr) { + var self = MochiKit.Signal; + var ident1 = self.connect(src, sig, objOrFunc, funcOrStr); + var ident2; + ident2 = self.connect(src, sig, function() { + self.disconnect(ident1); + self.disconnect(ident2); + }); + return ident1; + }, + _disconnect: function (ident) { @@ -717,3 +730,3 @@ MochiKit.Base.update(MochiKit.Signal, { self._disconnect(o); - if (!self._lock) { + if (self._lock === 0) { observers.splice(i, 1); @@ -729,3 +742,3 @@ MochiKit.Base.update(MochiKit.Signal, { self._disconnect(ident); - if (!self._lock) { + if (self._lock === 0) { observers.splice(idx, 1); @@ -745,3 +758,3 @@ MochiKit.Base.update(MochiKit.Signal, { var disconnect = self._disconnect; - var locked = self._lock; + var lock = self._lock; var dirty = self._dirty; @@ -755,6 +768,6 @@ MochiKit.Base.update(MochiKit.Signal, { disconnect(ident); - if (locked) { - dirty = true; - } else { + if (lock === 0) { observers.splice(i, 1); + } else { + dirty = true; } @@ -776,3 +789,3 @@ MochiKit.Base.update(MochiKit.Signal, { var i, ident; - var locked = self._lock; + var lock = self._lock; var dirty = self._dirty; @@ -784,3 +797,3 @@ MochiKit.Base.update(MochiKit.Signal, { disconnect(ident); - if (!locked) { + if (lock === 0) { observers.splice(i, 1); @@ -800,3 +813,3 @@ MochiKit.Base.update(MochiKit.Signal, { disconnect(ident); - if (!locked) { + if (lock === 0) { observers.splice(i, 1); @@ -820,3 +833,3 @@ MochiKit.Base.update(MochiKit.Signal, { var errors = []; - self._lock = true; + self._lock++; for (var i = 0; i < observers.length; i++) { @@ -839,4 +852,4 @@ MochiKit.Base.update(MochiKit.Signal, { } - self._lock = false; - if (self._dirty) { + self._lock--; + if (self._lock === 0 && self._dirty) { self._dirty = false; @@ -863,3 +876,3 @@ MochiKit.Signal.__new__ = function (win) { this._window = win; - this._lock = false; + this._lock = 0; this._dirty = false; |