Re: [whatwg/dom] Clarification on construction and creation of events (#372)

So, more concretely, in relation to creation, I have the following:

```
[Constructor(DOMString typeArg, optional BeforeInstallPromptEventInit eventInit)]
interface BeforeInstallPromptEvent : Event {
    Promise<PromptResponseObject> prompt();
};

dictionary BeforeInstallPromptEventInit : EventInit {
  AppBannerPromptOutcome userChoice;
};

dictionary PromptResponseObject {
  AppBannerPromptOutcome userChoice;
};
```

In the create algo, the spec says:

> For each dictionary member present in eventInitDict, find the attribute on event whose identifier matches the key of the dictionary member and then set the attribute to the value of that dictionary member.

But `BeforeInstallPromptEvent` doesn't have a matching "userChoice" for `BeforeInstallPromptEventInit.userChoice`. 

My intention was so developers could construct these events and have `.prompt()` resolve immediately for testing purposes:

```JS
var x = new BeforeInstallPromptEvent("beforeinstalmprompt", {userChoice: "accepted"})
x.prompt().then(({userChoice}) => `The user selected: ${userChoice}`)
```

But not realizing that this is incompatible with the create algo 😢. I should probably drop `BeforeInstallPromptEventInit`, right? 


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/372#issuecomment-259598448

Received on Thursday, 10 November 2016 04:21:40 UTC