TimeEvent: initTimeEvent() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The TimeEvent.initTimeEvent() method initializes the value of a TimeEvent created using Document.createEvent().
This method may only be called before the event has been dispatched via EventTarget.dispatchEvent(). If called multiple times, the final call takes precedence.
Note:
Document.createEvent() is deprecated in favor of event constructors, but TimeEvent has no dedicated constructor. CustomEvent is not a valid replacement, as it does not produce a TimeEvent instance with the interface's view and detail attributes.
Syntax
initTimeEvent(type)
initTimeEvent(type, view)
initTimeEvent(type, view, detail)
Parameters
type-
A string specifying the event type.
viewOptional-
The
Windowfrom which the event was generated. Ifnullor omitted, theTimeEvent.viewattribute of the event will benull. Defaults tonull. detailOptional-
A
longproviding contextual information about the event. Defaults to0.
Return value
None (undefined).
Examples
>Dispatching a repeatEvent
const evt = document.createEvent("TimeEvent");
evt.initTimeEvent("repeatEvent", window, 2);
svgElement.dispatchEvent(evt);
Specifications
| Specification |
|---|
| SVG Animations Level 2> # __svg__TimeEvent__initTimeEvent> |