-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Put custom event definitions in class #7640
base: main
Are you sure you want to change the base?
Conversation
lib/event/error_event.js
Outdated
* specific error that occurred. In an uncompiled build, you can also use the | ||
* <code>message</code> and <code>stack</code> properties to debug. | ||
* @extends {shaka.util.FakeEvent} | ||
* @exportDoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, but should this be @export
so it can be called by apps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change to @export the documentation is not generated correctly.... I don't know why...
lib/player.js
Outdated
@@ -35,6 +35,7 @@ goog.require('shaka.media.StreamingEngine'); | |||
goog.require('shaka.media.TimeRangesUtils'); | |||
goog.require('shaka.net.NetworkingEngine'); | |||
goog.require('shaka.net.NetworkingUtils'); | |||
goog.require('shaka.Player.ErrorEvent'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the errors are caused by ordering and namespaces here. goog.require here will assign the ErrorEvent class to shaka.Player.ErrorEvent. Later in this file, we assign shaka.Player = class ..., overwriting what was assigned to ErrorEvent by replacing the whole shaka.Player namespace.
So we might need to do something like this:
- Rename shaka.Player.ErrorEvent to shaka.errors.ErrorEvent, giving errors their own namespace
For backward compatibility, assign shaka.Player.ErrorEvent = shaka.errors.ErrorEvent after the definition of shaka.Player- Actually, no need for backward compatibility. That class never existed at runtime, and was also never in our externs. It only ever existed as a doc, so it's fine to rename it AFAICT. But the new name should be exported so it's in the generated externs/defs, where other projects can refer to it as a strong type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but I used shaka.events.ErrorEvent
instead
Close #1564