aboutsummaryrefslogtreecommitdiff
path: root/src/headless.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-22 17:09:02 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-22 17:09:02 -0800
commit7dfbd9ac5ec8d096cbc147d7693814d2d81568bc (patch)
treebaa38c9f0c8cc62d480ca486cc90b13a755762a2 /src/headless.js
parent00c0ccc15b36742bdbb472ce09b1eae7616e822f (diff)
some headless additions
Diffstat (limited to 'src/headless.js')
-rw-r--r--src/headless.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/headless.js b/src/headless.js
index e5458641..5880c087 100644
--- a/src/headless.js
+++ b/src/headless.js
@@ -82,6 +82,16 @@ var window = {
}
listeners.push(func);
},
+ removeEventListener: function(id, func) {
+ var listeners = this.eventListeners[id];
+ if (!listeners) return;
+ for (var i = 0; i < listeners.length; i++) {
+ if (listeners[i] === func) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ },
callEventListeners: function(id) {
var listeners = this.eventListeners[id];
if (listeners) {
@@ -101,6 +111,7 @@ var document = {
headless: true,
eventListeners: {},
addEventListener: window.addEventListener,
+ removeEventListener: window.removeEventListener,
callEventListeners: window.callEventListeners,
getElementById: function(id) {
switch(id) {
@@ -144,6 +155,7 @@ var document = {
},
eventListeners: {},
addEventListener: document.addEventListener,
+ removeEventListener: document.removeEventListener,
callEventListeners: document.callEventListeners,
};
};