-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Script Modules API: Add deregister module function #6061
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -151,6 +151,20 @@ public function dequeue( string $id ) { | |||||
| unset( $this->enqueued_before_registered[ $id ] ); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Deregister the script module so it will no longer be registered. | ||||||
| * | ||||||
| * @since 6.5.0 | ||||||
| * | ||||||
| * @param string $id The identifier of the script module. | ||||||
| */ | ||||||
| public function deregister( string $id ) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it "unregister" or "deregister"? It seems on Core, we use "unregister" everywhere except for WP_Scripts and Styles. It seems a bit awkward. I understand the reasoning about modules being scripts to keep them consistent but wanted to mention.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, that's unfortunate. It's probably better to keep it awkward but similar to scripts. I don't have strong opinion here though 😅
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's even more interesting:
but:
|
||||||
| if ( isset( $this->registered[ $id ] ) ) { | ||||||
gziolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| unset( $this->registered[ $id ] ); | ||||||
| } | ||||||
| unset( $this->enqueued_before_registered[ $id ] ); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Adds the hooks to print the import map, enqueued script modules and script | ||||||
| * module preloads. | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.