- From: Aryeh Gregor <ayg@aryeh.name>
- Date: Sun, 23 Apr 2017 16:35:12 +0300
- To: www-smil@w3.org
The SMIL standard has the following interface:
interface TimeEvent : events::Event {
readonly attribute views::AbstractView view;
readonly attribute long detail;
void initTimeEvent(in DOMString typeArg,
in views::AbstractView viewArg,
in long detailArg);
};
<https://www.w3.org/TR/smil/smil-timing.html>
Nowadays we're updating all events to have constructors, so instead of
var e = document.createEvent("timeevent");
e.initTimeEvent("foo", window, -7);
you do
var e = new TimeEvent("foo", {view: window, detail: -7});
This is a better pattern because it doesn't allow uninitialized
objects; allows omitting fields from initialization; and names
initialized fields instead of relying on positional notation
(especially important if there are many parameters to initialize).
Specs such as HTML have been updated to add constructors for existing
event types.
Is it possible to issue errata for the SMIL spec to change the IDL to
WebIDL with a constructor? Here's a sample that should work:
dictionary TimeEventInit : EventInit {
Window? view = null;
long detail = 0; // or -1, or pick another default
};
[Constructor(DOMString type, optional TimeEventDict eventInitDict)]
interface TimeEvent : Event
{
readonly attribute WindowProxy? view;
readonly attribute long detail;
void initTimeEvent(DOMString typeArg,
optional Window? viewArg = null,
optional long detailArg = 0);
};
If it's desired that some of the values must be specified and not have
default values, that could be done too, but I don't know the proper
way offhand.
Thanks!
Received on Sunday, 23 April 2017 13:36:06 UTC