3 ms·
Canvas is part of the DOM. It is a DOM element that JS can draw graphics on.
by orange8 9y ago
Canvas is part of the DOM. It is a DOM element that JS can draw graphics on.
- abecedarius 9y agoNot a problem: you can ask the canvas for an arraybuffer to draw on, and pass that to the wasm code. I did this with asm.js in place of wasm (which didn't exist yet) in http://wry.me/hacking/Turing-Drawings/ http://wry.me/hacking/Turing-Drawings/ and you can judge the speed yourself. (As that page describes, there was some overhead from calling from JS to asm.js at least when asm.js first came out. I don't know the current figures.)
- orange8 9y agoasm.js is valid Javascript. It is a valid subset of js that the browser js engines understand, even for the older ones like IE 8. JavaScript has direct access to the DOM, with webassembly, not yet. It may in the future, its still in the proposal phrase (https://github.com/WebAssembly/gc/blob/master/proposals/gc/Overview.md https://github.com/WebAssembly/gc/blob/master/proposals/gc/O...) So the way to do it today would be WebAssembly -> asm.js/js -> canvas
- abecedarius 9y agoGood point about the proposal -- that'll be the answer in the end. asmj.js as JS is irrelevant to the point I was making, because if you access the DOM directly, your code won't verify as the asm.js subset, and so won't run via the asm.js engine.
- orange8 9y agoThe asm.js engine is the javascript engine. asm.js is javascript. asm.js === javscript
- abecedarius 9y agoNo: that's a choice that Chrome made and Firefox didn't, for example.
- deleted 9y ago[deleted]