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
Event constructors are missing arguments #1067
Comments
Yes, this makes sense to me and we should do this. |
This was my mistake. |
@RByers Rick, I have few questions on this - just to understand how this custom event works.
I would love to change the name of the event to |
All the constructor lets you do is initialize an event object, passing values through directly - exactly as the browser does internally. So you just accept values in the "Init" dictionary that correspond to each of the properties on the event. For OfflineAudioCompletionEvent it looks like that means you'd take a
Events are dumb, so if the event type allows
Again none of this should matter - the event is just a dumb container, doesn't interact with any of the webaudio code inside the UA itself. Sure if a library actually generated bogus events it might confuse some other JS on the page, but that's fine (no different from all the other ways one piece of JS can confuse another). Think of it this way: a DOM event is just a generic notification with some particular bundle of information attached. The information flow is one way from the browser to JS via the events. Creating a synthetic event in JS is completely hidden from (and so irrelevant to) any of the browser WebAudio code. |
@joeberkovitz Since I was working on an intent to implement and ship for this in Chrome, I'm going to assign this to me, if you don't mind. Please feel free to change it back. |
The proposed constructors look like
and
|
Fix #1067: Add arguments to event constructors
The constructors added in #566 don't follow the pattern of other event constructors. I believe just saying
[Constructpr]
onOfflineAudioCompletionEvent
means you can donew OfflineAudioCompletionEvent()
but you can't do anything interesting with that because there's no good way to set the event properties (including the event type). Instead you want to take the event type string and a dictionary (which inherits from theEventInit
dictionary) so that developers can donew OfflineAudioCompletionEvent("complete", {renderedBuffer: buf})
.Eg. see the definition of CustomEvent and MouseEvent.
The text was updated successfully, but these errors were encountered: