-
-
Save toolsley/f7f645f1f2a0a6dd6084 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function () { | |
var a = function () { // valid asm.js module | |
'use asm'; | |
function b() { | |
return+0 | |
} | |
return{b: b} // export method | |
}(); // create the module | |
return!('prototype'in a.b); // and check whether the exported function is JS or native | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(){var a=function(){'use asm';function b(){return+0}return{b:b}}();return!('prototype'in a.b)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isAsmJsSupported | |
Written in 2014 by Toolsley | |
To the extent possible under law, the author(s) have dedicated all copyright | |
and related and neighboring rights to this software to the public domain worldwide. | |
This software is distributed without any warranty. | |
http://creativecommons.org/publicdomain/zero/1.0/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "isAsmJsSupported", | |
"description": "checks whether the browser can compile asm.js modules", | |
"keywords": [ | |
"asm.js", | |
"detect", | |
"support", | |
"compile" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<title>Is asm.js supported by this browser?</title> | |
<div>Is asm.js supported by this browser?</div> | |
<div>The answer is: <b id="ret"></b></div> | |
<script> | |
var isAsmJsSupported = function(){var a=function(){'use asm';function b(){return+0}return{b:b}}();return!('prototype'in a.b);} | |
document.getElementById("ret").innerHTML = isAsmJsSupported() ? "Yes!" : "No."; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment