Skip to content
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

Merged
merged 6 commits into from
Feb 8, 2024
Merged

Conversation

willeastcott
Copy link
Contributor

This PR is a reasonably simple refactor of the ResourceHandlers. 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.

@willeastcott
Copy link
Contributor Author

@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.

Copy link
Contributor

@mvaligursky mvaligursky left a 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
Copy link
Member

@slimbuck slimbuck Aug 18, 2023

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).

Copy link
Collaborator

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?

Copy link
Member

@slimbuck slimbuck left a comment

Choose a reason for hiding this comment

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

Awesome!

@kungfooman
Copy link
Collaborator

Niiice, I much prefer a proper prototype chain and the reduced amount of "special" stuff to care about in types-fixup.mjs 👍

Make sure to only replace @implements with @augments though, otherwise doc generation isn't picking it up?

@willeastcott
Copy link
Contributor Author

willeastcott commented Aug 18, 2023

@kungfooman Yes, I realized yesterday I need to add @augments - I'll add that. FYI, Typedoc doesn't need @augments because it understands the structure of the code.

@kpal81xd
Copy link
Contributor

kpal81xd commented Feb 7, 2024

Going to remove #6043 since it is a duplicate PR @willeastcott I have updated the branch by merging main in.

@kpal81xd kpal81xd requested a review from a team February 7, 2024 14:05
Copy link
Contributor

@mvaligursky mvaligursky left a 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 ?

@slimbuck
Copy link
Member

slimbuck commented Feb 8, 2024

Looks good. Keen to merge this @slimbuck ?

Yebo! 👍🏻

@slimbuck slimbuck merged commit 22161ce into main Feb 8, 2024
7 checks passed
@slimbuck slimbuck deleted the refactor-handlers branch February 8, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants