Skip to content

Commit

Permalink
Tighten up event init dictionary definition
Browse files Browse the repository at this point in the history
Closes #11.

Since both places in the spec initialize both attributes immediately, and the dictionary contains required for promise and = null for reason, there is no need to specify in prose a default value for the attributes anymore.
  • Loading branch information
domenic committed Jul 1, 2015
1 parent e86e484 commit 463179c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -108,14 +108,14 @@ interface PromiseRejectionEvent : Event {
};
dictionary PromiseRejectionEventInit : EventInit {
Promise<any>? promise;
any reason;
required Promise<any>? promise;
any reason = null;
};
```

The `promise` attribute must return the value it was initialised to. When the object is created, this attribute must be initialised to null. It represents the promise which this notification is about.
The `promise` attribute must return the value it was initialised to. It represents the promise which this notification is about.

The `reason` attribute must return the value it was initialized to. When the object is created, this attribute must be initialised to null. It represents the rejection reason for the promise.
The `reason` attribute must return the value it was initialized to. It represents the rejection reason for the promise.

## [WindowEventHandlers](https://html.spec.whatwg.org/multipage/webappapis.html#windoweventhandlers)

Expand Down

2 comments on commit 463179c

@domenic
Copy link
Owner Author

@domenic domenic commented on 463179c Oct 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@foolip do you remember why we added required here? It seems unusual for event init dicts.

@foolip
Copy link

@foolip foolip commented on 463179c Oct 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this doesn't ring any bells, and it does look odd given that it's nullable.

I vaguely remember something about required being a good idea when the dictionary argument itself is required, since a "required" argument that will accept just {} as an argument is silly. However, that isn't the situation here.

Please sign in to comment.