Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

AbstractWorker.onerror

概述

AbstractWorker接口的onerror特性是一个事件句柄,在 Workererror事件触发并冒泡时执行。

语法

myWorker.onerror = function() { ... };

示例

下面的代码片段展示了通过 Worker() 创建 Worker 对象的过程, 以及设置onerror回调函数:

var myWorker = new Worker("worker.js");

myWorker.onerror = function() {
  console.log('There is an error with your worker!');
}

规范

Specification Status Comment
WHATWG HTML Living Standard
AbstractWorker.onerror
Living Standard No change from Web Workers.
Web Workers
AbstractWorker.onerror
Editor's Draft Initial definition.

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 4 3.5 (1.9.1) 10 10.6 4
Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 4.4 1.0 (1.9.1) 1.0.1 10 11.5 5.1

另请参阅

文档标签和贡献者

 此页面的贡献者: liuzeyafzy
 最后编辑者: liuzeyafzy,