diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-09-12 14:31:52 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-09-12 14:31:52 -0700 |
commit | 341ea63b6f109adf914689d9d9a399b363419ba1 (patch) | |
tree | 8ac1940e74e9a764e96edf3528dac1baf1caa2ec /tools | |
parent | 97bee9986d71a28a964602af4c0e85b245822145 (diff) |
events and audio in shell replay
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/reproduceriter.py | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tools/reproduceriter.py b/tools/reproduceriter.py index 5f428fd6..255dbb2d 100755 --- a/tools/reproduceriter.py +++ b/tools/reproduceriter.py @@ -172,6 +172,20 @@ if (typeof nagivator == 'undefined') { }; var setTimeout = window.setTimeout; var document = { + eventListeners: {}, + addEventListener: function(id, func) { + var listeners = document.eventListeners[id]; + if (!listeners) { + listeners = document.eventListeners[id] = []; + } + listeners.push(func); + }, + callEventListeners: function(id) { + var listeners = document.eventListeners[id]; + if (listeners) { + listeners.forEach(function(listener) { listener() }); + } + }, getElementById: function(id) { switch(id) { case 'canvas': { @@ -181,19 +195,25 @@ if (typeof nagivator == 'undefined') { case 'experimental-webgl': { return { getExtension: function() { return 1 }, - requestPointerLock: function() { - throw 'pointerLock'; - }, }; } default: throw 'canvas.getContext: ' + which; } }, + requestPointerLock: function() { + document.callEventListeners('pointerlockchange'); + }, }; } default: throw 'getElementById: ' + id; } }, + createElement: function(what) { + switch (what) { + case 'canvas': return document.getElementById(what); + default: throw 'createElement ' + what; + } + }, querySelector: function() { return { classList: { @@ -244,6 +264,9 @@ if (typeof nagivator == 'undefined') { }, }; }; + var Audio = function() { + return { play: function(){} }; + }; } var Recorder = (function() { |