Talk:Canvas Nasal/JavaScript Subset: Difference between revisions
Jump to navigation
Jump to search
(add old stub ...) |
No edit summary |
||
Line 1: | Line 1: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
if (typeof( | if(typeof(console) != 'object') { | ||
console = {log: print}; | console = {log: print}; | ||
} | } | ||
Line 7: | Line 7: | ||
} | } | ||
var runtime = compile("return (typeof(0)=='scalar')? 'nasal':'javascript';"); | var runtime = compile("return (typeof(0)=='scalar')? 'nasal':'javascript';") (); | ||
Wrapper = { | Wrapper = { | ||
Line 23: | Line 23: | ||
console.log( runtime | console.log( runtime ); | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 22:03, 30 January 2018
if(typeof(console) != 'object') {
console = {log: print};
}
else {
compile = eval("new Function('src','return new Function(src);')");
}
var runtime = compile("return (typeof(0)=='scalar')? 'nasal':'javascript';") ();
Wrapper = {
'nasal': {
setprop: compile(0),
getprop: compile(1),
fgcommand: compile(2)
},
'javascript': {
}
};
console.log( runtime );