WebAssembly.validate()
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2017ë 10ì.
* Some parts of this feature may have varying levels of support.
WebAssembly.validate() í¨ìë ë°ì´í¸ê° ì í¨í wasm 모ëì íì±íëì§ (true) ëë ìì±íì§ ìëì§ (false)를 ë°ííì¬ WebAssembly ë°ì´ë리 ì½ëì ì§ì ë typed arrayì ì í¨ì±ì ê²ì¬í©ëë¤.
Syntax
WebAssembly.validate(bufferSource);
Parameters
bufferSource-
ì í¨ì±ì ê²ì¬ í WebAssembly ë°ì´ë리 ì½ëê° ë¤ì´ìë typed array ëë ArrayBufferì ëë¤.
Return value
bufferSourceê° ì í¨í wasm ì½ë (true)ì¸ì§ ìëì§ (false)를 ì§ì íë ë¶ì¸ì
ëë¤.
Exceptions
bufferSourceê° typed arrayì´ë ArrayBufferê° ìë ê²½ì° TypeErrorê° ë°ìí©ëë¤.
Examples
ë¤ì ìì (validate.html source code 참조 ë° see it live)ë .wasm 모ëì ê°ì ¸ ìì íìí ë ë°°ì´ë¡ ë³íí©ëë¤. ê·¸ë° ë¤ì validate() ë©ìë를 ì¬ì©íì¬ ëª¨ëì´ ì í¨íì§ íì¸í©ëë¤.
fetch("simple.wasm")
.then((response) => response.arrayBuffer())
.then(function (bytes) {
var valid = WebAssembly.validate(bytes);
console.log(
"The given bytes are " + (valid ? "" : "not ") + "a valid wasm module",
);
});
ëª ì¸ì
| Specification |
|---|
| WebAssembly JavaScript Interface> # dom-webassembly-validate> |