CustomEvent.initCustomEvent()
已弃用: 不再推荐使用该特性。虽然一些浏览器仍然支持它,但也许已从相关的 web 标准中移除,也许正准备移除或出于兼容性而保留。请尽量不要使用该特性,并更新现有的代码;参见本页面底部的兼容性表格以指导你作出决定。请注意,该特性随时可能无法正常工作。
CustomEvent.initCustomEvent()
方法初始化了一个 CustomEvent
object. 如果该事件已经被分发出去,则不会在初始化过程中重复触发.
这类对象一定是由 Document.createEvent()
方法创建的。该方法被分发之前必须通过EventTarget.dispatchEvent()
方法设置.一旦被分发则,则无法被重新设置.
备注: 该方法已经作废,不要在新项目中继续使用该方法。
Instead use specific event constructors, like CustomEvent()
. The page on Creating and triggering events gives more information about the way to use these.
语法
js
event.initCustomEvent(type, canBubble, cancelable, detail)
参数
规范
Specification |
---|
DOM Standard # dom-customevent-initcustomevent |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
initCustomEvent |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Deprecated. Not for use in new websites.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
CustomEvent
- The constructor to use instead of this deprecated method:
CustomEvent()
.