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

js
initTimeEvent(type)
initTimeEvent(type, view)
initTimeEvent(type, view, detail)

Parameters

type

A string specifying the event type.

view Optional

The Window from which the event was generated. If null or omitted, the TimeEvent.view attribute of the event will be null. Defaults to null.

detail Optional

A long providing contextual information about the event. Defaults to 0.

Return value

None (undefined).

Examples

Dispatching a repeatEvent

js
const evt = document.createEvent("TimeEvent");
evt.initTimeEvent("repeatEvent", window, 2);
svgElement.dispatchEvent(evt);

Specifications

Specification
SVG Animations Level 2
# __svg__TimeEvent__initTimeEvent

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
initTimeEvent
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 4 (Release date: 2011-03-22)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also