-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider not defining a custom WakeLockEvent #238
Comments
CC @marcoscaceres who was there when we defined |
Yes, great point @reillyeon. We just need a simple Event. |
rakuco
added a commit
to rakuco/wake-lock
that referenced
this issue
Oct 17, 2019
Per https://w3ctag.github.io/design-principles/#state-and-subclassing, we do not really need a custom event class here. `WakeLockEvent` has a single attribute, `lock`, that points to the event target. That's exactly what `Event.target` also does, so we can just create a simple `Event` instance and let the "fire an event" DOM algorithm set `target` for us to achieve the same thing. In fact, it already does, so before this commit we had ev.lock === ev.target Fixes w3c#238.
4 tasks
rakuco
added a commit
to rakuco/wake-lock
that referenced
this issue
Oct 18, 2019
Per https://w3ctag.github.io/design-principles/#state-and-subclassing, we do not really need a custom event class here. `WakeLockEvent` has a single attribute, `lock`, that points to the event target. That's exactly what `Event.target` also does, so we can just create a simple `Event` instance and let the "fire an event" DOM algorithm set `target` for us to achieve the same thing. In fact, it already does, so before this commit we had ev.lock === ev.target Fixes w3c#238.
rakuco
added a commit
that referenced
this issue
Oct 18, 2019
Per https://w3ctag.github.io/design-principles/#state-and-subclassing, we do not really need a custom event class here. `WakeLockEvent` has a single attribute, `lock`, that points to the event target. That's exactly what `Event.target` also does, so we can just create a simple `Event` instance and let the "fire an event" DOM algorithm set `target` for us to achieve the same thing. In fact, it already does, so before this commit we had ev.lock === ev.target Fixes #238.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reading the TAG design principles I noticed § 3.7. State and Event subclasses which recommends against creating custom
Event
subclasses and instead capturing state in thetarget
parameter.Example code with current API,
Since the event is already fired on
lock
thelock
attribute on the event could be removed, resulting in this code,The text was updated successfully, but these errors were encountered: