WebAssembly.LinkError() 构造器创建一个新的WebAssembly LinkError 对象, 该对象表明一个模块创建时(besides traps from the start function)发生的错误.
new WebAssembly.LinkError(message, fileName, lineNumber)
message 可选fileName 可选 lineNumber 可选 LinkError 不包含自己独立的属性, 它仅仅继承了原型链上的属性.
WebAssembly.LinkError.prototype.constructorWebAssembly.LinkError.prototype.messageURIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message.WebAssembly.LinkError.prototype.nameError.WebAssembly.LinkError.prototype.fileNameError.WebAssembly.LinkError.prototype.lineNumberError.WebAssembly.LinkError.prototype.columnNumberError.WebAssembly.LinkError.prototype.stackError.The LinkError constructor contains no methods of its own, however, it does inherit some methods through the prototype chain.
WebAssembly.LinkError.prototype.toSource()WebAssembly.LinkError.prototype.toString()Error 对象的文字. 继承自 Error.下列代码片段创建了一个新的 LinkError 实例, 并将其打印到控制台:
try {
throw new WebAssembly.LinkError('Hello', 'someFile', 10);
} catch (e) {
console.log(e instanceof LinkError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "LinkError"
console.log(e.fileName); // "someFile"
console.log(e.lineNumber); // 10
console.log(e.columnNumber); // 0
console.log(e.stack); // returns the location where the code was run
}
| Specification | Status | Comment |
|---|---|---|
| WebAssembly JavaScript Interface WebAssembly constructors |
Working Draft | Initial WebAssembly draft definition. |
| ECMAScript Latest Draft (ECMA-262) NativeError |
Draft | Definition of standard NativeError types. |
| Desktop | Mobile | Server | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LinkError | Chrome Full support 57 | Edge Full support 16 | Firefox
Full support
52
| IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile
Full support
Yes
| Firefox Android
Full support
52
| Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0 |