这篇翻译不完整。请帮忙从英语翻译这篇文章

接口 CustomEvent 的只读属性 detail (详情)返回在初始化事件对象时传递过来的任何类型数据。

Note: 此特性在 Web Worker 中可用。

Syntax

 let myDetail = customEventInstance.detail;

Return value

事件对象初始化时传递的任何类型数据。

Example

// add an appropriate event listener
obj.addEventListener("cat", function(e) { process(e.detail) });

// create and dispatch the event
let event = new CustomEvent("cat", {
  detail: {
    hazcheeseburger: true
  }
});
obj.dispatchEvent(event);

// Will return an object contaning the hazcheeseburger property
let myDetail = event.detail;

Specifications

Specification Status Comment
DOM
detail
Living Standard Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support11 ?11 No11.6 No1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes ?14 Yes No1 ?

1. Available on Nightly build (535.2)

See also

 

文档标签和贡献者

此页面的贡献者: sunline.bucket
最后编辑者: sunline.bucket,