Re: [heycam/webidl] Define a callback constructor type (#701)

What about something like this:

```
// No inheritance required
interface dictionary Foo {
 // Same `constructor` as usual
 constructor(...);

 // Works like standard `dictionary` properties
 static Type someStaticProp;
 static Type someStaticProp = "default";
 required static Type someStaticProp;

 // Instance property
 attribute Type someInstanceProp;
 attribute Type someInstanceProp = "default";
 required attribute Type someInstanceProp;

 // Instance method
 attribute Type someMethod(...);
 required attribute Type someMethod(...);
};

// Works like above, but requires instances to extend a particular interface,
// like via `class MyFoo extends Bar {}`. Note: it can only otherwise extend
// other interface dictionaries, much like how dictionaries can only extend
// from other dictionaries.
interface Bar { ... }
interface dictionary Foo : Bar { ... }
```

Concept is rough, and it is *technically* larger than everything else that's been proposed here, but it aligns pretty well conceptually with WebIDL's current processing model and shouldn't require more than mechanical changes from how it's currently consumed. It also is intended to satisfy the needs of both [Houdini](https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback), custom elements, and worklets.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/701#issuecomment-562479797

Received on Friday, 6 December 2019 08:25:56 UTC