Skip to content
Permalink
Browse files

New Bytecoder Demos...

  • Loading branch information...
mirkosertic committed Dec 10, 2018
1 parent 0ab8485 commit 49c18544e6ab40c1e8558bbb21101e6622979665

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

@@ -44,9 +44,13 @@ var bytecoder = {

toJSEventListener: function(value) {
return function(event) {
var eventIndex = bytecoder.toBytecoderReference(event);
bytecoder.exports.summonCallback(0,value,theIndex);
delete bytecoder.referenceTable[eventIndex];
try {
var eventIndex = bytecoder.toBytecoderReference(event);
bytecoder.exports.summonCallback(0,value,eventIndex);
delete bytecoder.referenceTable[eventIndex];
} catch (e) {
console.log(e);
}
};
},

@@ -163,15 +167,15 @@ var bytecoder = {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getContext(bytecoder.toJSString(arg0)));
},
},
parentnode: {
getElementById: function(target,arg0) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getElementById(bytecoder.toJSString(arg0)));
},
},
window: {
document: function(target) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].document);
},
},
element: {
getElementById: function(target,arg0) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getElementById(bytecoder.toJSString(arg0)));
},
},
},
};

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

@@ -44,9 +44,13 @@ var bytecoder = {

toJSEventListener: function(value) {
return function(event) {
var eventIndex = bytecoder.toBytecoderReference(event);
bytecoder.exports.summonCallback(0,value,theIndex);
delete bytecoder.referenceTable[eventIndex];
try {
var eventIndex = bytecoder.toBytecoderReference(event);
bytecoder.exports.summonCallback(0,value,eventIndex);
delete bytecoder.referenceTable[eventIndex];
} catch (e) {
console.log(e);
}
};
},

@@ -163,14 +167,32 @@ var bytecoder = {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getContext(bytecoder.toJSString(arg0)));
},
},
htmlelement: {
style: function(target) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].style);
},
},
cssstyledeclaration: {
setProperty: function(target,arg0,arg1) {
bytecoder.referenceTable[target].setProperty(bytecoder.toJSString(arg0),bytecoder.toJSString(arg1));
},
},
parentnode: {
getElementById: function(target,arg0) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getElementById(bytecoder.toJSString(arg0)));
},
},
window: {
document: function(target) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].document);
},
requestAnimationFrame: function(target,arg0) {
bytecoder.referenceTable[target].requestAnimationFrame(bytecoder.toJSEventListener(arg0));
},
},
element: {
getElementById: function(target,arg0) {
return bytecoder.toBytecoderReference(bytecoder.referenceTable[target].getElementById(bytecoder.toJSString(arg0)));
eventtarget: {
addEventListener: function(target,arg0,arg1) {
bytecoder.referenceTable[target].addEventListener(bytecoder.toJSString(arg0),bytecoder.toJSEventListener(arg1));
},
},
},
@@ -6,7 +6,7 @@
<canvas id="benchmark-canvas" width="600" height="600"></canvas>
<script type="text/javascript" src="stats.min.js"></script>
<script type="text/javascript" src="bytecoder.js"></script>
<button id="button" onclick="start()" value="Click me" style="display: none">Click Me</button>
<button id="button" value="Click me" style="display: none">Click Me</button>
<table border="1">
<tr>
<td>Avg ms / Frame</td>
@@ -70,6 +70,14 @@
});
}
};
bytecoder.imports.stats = {
begin: function() {
stats.begin();
},
end: function() {
stats.end();
}
};
console.log("Init");
bytecoder.bootstrap();
@@ -78,19 +86,6 @@
console.log("Ready");
document.getElementById("button").style.display = "block";
var stepFunction = function(timestamp) {
stats.begin();
bytecoder.exports.proceedSimulation();
stats.end();
window.requestAnimationFrame(stepFunction);
};
var start = function() {
document.getElementById("button").disabled = true;
stepFunction();
};
</script>
</body>
</html>
@@ -6,7 +6,7 @@
<canvas id="benchmark-canvas" width="600" height="600"></canvas>
<script type="text/javascript" src="stats.min.js"></script>
<script type="text/javascript" src="bytecoder-closure.js"></script>
<button id="button" onclick="start()" value="Click me" style="display: none">Click Me</button>
<button id="button" value="Click me" style="display: none">Click Me</button>
<table border="1">
<tr>
<td>Avg ms / Frame</td>
@@ -69,6 +69,14 @@
});
}
};
bytecoder.imports.stats = {
begin: function() {
stats.begin();
},
end: function() {
stats.end();
}
};
console.log("Init");
bytecoder.bootstrap();
@@ -77,19 +85,6 @@
console.log("Ready");
document.getElementById("button").style.display = "block";
var stepFunction = function(timestamp) {
stats.begin();
bytecoder.exports.proceedSimulation();
stats.end();
window.requestAnimationFrame(stepFunction);
};
var start = function() {
document.getElementById("button").disabled = true;
stepFunction();
};
</script>
</body>
</html>
@@ -5,7 +5,7 @@
<body>
<canvas id="benchmark-canvas" width="600" height="600"></canvas>
<script type="text/javascript" src="stats.min.js"></script>
<button id="button" onclick="start()" value="Click me" style="display: none">Click Me</button>
<button id="button" value="Click me" style="display: none">Click Me</button>
<table border="1">
<tr>
<td>Avg ms / Frame</td>
@@ -68,6 +68,14 @@
});
}
};
bytecoder.imports.stats = {
begin: function() {
stats.begin();
},
end: function() {
stats.end();
}
};
// Try to load the WASM file
var request = new XMLHttpRequest();
@@ -92,19 +100,6 @@
var bytes = request.response;
WebAssembly.instantiate(bytes, bytecoder.imports).then(instantiated);
};
var stepFunction = function(timestamp) {
stats.begin();
bytecoder.exports.proceedSimulation(0);
stats.end();
window.requestAnimationFrame(stepFunction);
};
var start = function() {
document.getElementById("button").disabled = true;
stepFunction();
};
</script>
</body>
</html>

0 comments on commit 49c1854

Please sign in to comment.
You can’t perform that action at this time.