From e9bb365b9be5f67d20c899af4e5a084daaad9670 Mon Sep 17 00:00:00 2001 From: portix Date: Wed, 18 Apr 2012 11:05:35 +0200 Subject: Adding scripts/lib, implementing signal functions --HG-- branch : scripts --- scripts/lib/signals.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/lib/signals.js (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js new file mode 100644 index 00000000..b01b2361 --- /dev/null +++ b/scripts/lib/signals.js @@ -0,0 +1,32 @@ + +Object.defineProperty(signals, "registered", { + value : {} +}); +Object.defineProperty(signals, "emit", { + value : function(sig, wv, o) { + var sigs = signals.registered[sig]; + for (var i=0; i Date: Wed, 18 Apr 2012 12:42:49 +0200 Subject: Return id from connect --HG-- branch : scripts --- scripts/lib/signals.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index b01b2361..74b8e31f 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -1,32 +1,44 @@ -Object.defineProperty(signals, "registered", { +Object.defineProperty(signals, "_registered", { value : {} }); +Object.defineProperty(signals, "_maxId", { + value : 0, + writable : true +}); Object.defineProperty(signals, "emit", { value : function(sig, wv, o) { - var sigs = signals.registered[sig]; + var sigs = signals._registered[sig]; for (var i=0; i Date: Wed, 18 Apr 2012 15:33:38 +0200 Subject: Encapsulate all included scripts --HG-- branch : scripts --- scripts/lib/signals.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index 74b8e31f..27f465a3 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -17,7 +17,6 @@ Object.defineProperty(signals, "emit", { Object.defineProperty(signals, "connect", { value : function(sig, func) { signals._maxId++; - io.print(signals._maxId); if (signals._registered[sig] === undefined || signals._registered[sig] === null) { signals._registered[sig] = []; signals[sig] = function (wv, o) { @@ -41,4 +40,3 @@ Object.defineProperty(signals, "disconnect", { } } }); -io.print("a :" + a); -- cgit v1.2.3 From d10a7d948d82b4598317fab809e22bd3f7ca6cdc Mon Sep 17 00:00:00 2001 From: portix Date: Thu, 19 Apr 2012 00:58:47 +0200 Subject: Implementing inject and resource request --HG-- branch : scripts --- scripts/lib/signals.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index 27f465a3..04c72229 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -1,4 +1,3 @@ - Object.defineProperty(signals, "_registered", { value : {} }); @@ -9,22 +8,32 @@ Object.defineProperty(signals, "_maxId", { Object.defineProperty(signals, "emit", { value : function(sig, wv, o) { var sigs = signals._registered[sig]; + var ret = false; for (var i=0; i Date: Fri, 20 Apr 2012 00:59:40 +0200 Subject: Buttonpress/release, keypress/release, register/deregister signals on the fly, documentation --HG-- branch : scripts --- scripts/lib/signals.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index 04c72229..57ec6806 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -31,11 +31,6 @@ Object.defineProperty(signals, "connect", { return -1; } }); -Object.defineProperty(signals, "register", { - value : function (sig) { - signals.connect(sig, null); - } -}); Object.defineProperty(signals, "disconnect", { value : function(id) { var s, i, a; @@ -44,6 +39,8 @@ Object.defineProperty(signals, "disconnect", { for (i = 0; i Date: Fri, 20 Apr 2012 14:03:24 +0200 Subject: New signal downloadStatus --HG-- branch : scripts --- scripts/lib/signals.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index 57ec6806..ba2ad50a 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -33,15 +33,15 @@ Object.defineProperty(signals, "connect", { }); Object.defineProperty(signals, "disconnect", { value : function(id) { - var s, i, a; - for (s in signals._registered) { - a = signals._registered[s]; - for (i = 0; i Date: Mon, 23 Apr 2012 02:15:44 +0200 Subject: Exception message, rename plugins in extensions --HG-- branch : scripts --- scripts/lib/signals.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index ba2ad50a..fccf2674 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -9,7 +9,8 @@ Object.defineProperty(signals, "emit", { value : function(sig, wv, o) { var sigs = signals._registered[sig]; var ret = false; - for (var i=0; i Date: Sun, 29 Apr 2012 13:09:56 +0200 Subject: Get gobject properties from scripts; started rewriting of documentation --HG-- branch : scripts --- scripts/lib/signals.js | 125 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 42 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index fccf2674..303e823a 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -1,50 +1,91 @@ -Object.defineProperty(signals, "_registered", { - value : {} -}); -Object.defineProperty(signals, "_maxId", { - value : 0, - writable : true -}); -Object.defineProperty(signals, "emit", { - value : function(sig, wv, o) { - var sigs = signals._registered[sig]; - var ret = false; - var i; - for (i=0; i Date: Wed, 9 May 2012 01:58:30 +0200 Subject: Freeze extensions and data object, real private properties for the signal object. --HG-- branch : scripts --- scripts/lib/signals.js | 159 +++++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 79 deletions(-) (limited to 'scripts/lib/signals.js') diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index 303e823a..f254aea9 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -1,91 +1,92 @@ -Object.defineProperties(signals, { - "_registered" : { - value : {} - }, - "emit" : { - value : function(sig, args) { - var sigs = signals._registered[sig]; - var ret = false; - var i = 0; - do { - if (sigs[i].connected) { - ret = sigs[i].callback.apply(this, args) || ret; - i++; - } - else { - sigs.splice(i, 1); +(function () { + var _registered = {}; + Object.defineProperties(signals, { + "emit" : { + value : function(sig, args) { + var sigs = _registered[sig]; + var ret = false; + var i = 0; + do { + if (sigs[i].connected) { + ret = sigs[i].callback.apply(this, args) || ret; + i++; + } + else { + sigs.splice(i, 1); + } + } while (i