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

接口 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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 11Edge ? Firefox Full support 11IE No support NoOpera Full support 11.6Safari No support No
Notes
No support No
Notes
Notes Available on Nightly build (535.2)
WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support 14Opera Android Full support YesSafari iOS No support No
Notes
No support No
Notes
Notes Available on Nightly build (535.2)
Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

See also

 

文档标签和贡献者

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