-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Change ResourceHandler from interface to base class #5574
Conversation
@slimbuck I recall you saying previously that you don't like the asset system/resource handlers/etc, so I'm interested to get your reaction to this. |
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.
great cleanup!
@@ -28,36 +54,32 @@ class ResourceHandler { | |||
* ResourceLoader. | |||
*/ | |||
load(url, callback, asset) { | |||
throw new Error('not implemented'); | |||
// do nothing |
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 this default implementation should invoke callback
with failed result. Any caller hitting this function would hang indefinitely (and existing handler implementations that do nothing are probably wrong).
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.
Any conclusion on this? If handlers that do nothing are probably wrong, I guess we can just keep the throw statement aswell?
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.
Awesome!
Niiice, I much prefer a proper prototype chain and the reduced amount of "special" stuff to care about in Make sure to only replace |
@kungfooman Yes, I realized yesterday I need to add |
Going to remove #6043 since it is a duplicate PR @willeastcott I have updated the branch by merging main in. |
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.
Looks good.
Keen to merge this @slimbuck ?
Yebo! 👍🏻 |
This PR is a reasonably simple refactor of the
ResourceHandler
s. Specifically, it switches the effectively unused 'interface'ResourceHandler
(despite JavaScript not supporting interfaces) into a base class.I confirm I have read the contributing guidelines and signed the Contributor License Agreement.