aboutsummaryrefslogtreecommitdiff
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
parent00c0ccc15b36742bdbb472ce09b1eae7616e822f (diff)
some headless additions
-rw-r--r--src/headless.js12
-rw-r--r--src/headlessCanvas.js1
2 files changed, 13 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,
};
};
diff --git a/src/headlessCanvas.js b/src/headlessCanvas.js
index 4951aed8..6b0f9d47 100644
--- a/src/headlessCanvas.js
+++ b/src/headlessCanvas.js
@@ -600,6 +600,7 @@ function headlessCanvas() {
style: {},
eventListeners: {},
addEventListener: function(){},
+ removeEventListener: function(){},
requestFullScreen: function() {
document.fullscreenElement = document.getElementById('canvas');
window.setTimeout(function() {