WPDev.one
Core Class

WP_Script_Modules

class WP_Script_Modules // Constructor: function Object() { [native code] }

Core class used to register script modules.

Methods 14 methods

Method / Return Description
register()
void

Registers the script module if no script module with that script module

Parameters: $id: string, $src: string, $deps: array, $version: mixed
enqueue()
void

Marks the script module to be enqueued in the page.

Parameters: $id: string, $src: string, $deps: array, $version: mixed
dequeue()
void

Unmarks the script module so it will no longer be enqueued in the page.

Parameters: $id: string
deregister()
void

Removes a registered script module.

Parameters: $id: string
add_hooks()
void

Adds the hooks to print the import map, enqueued script modules and script

print_enqueued_script_modules()
void

Prints the enqueued script modules using script tags with type="module"

print_script_module_preloads()
void

Prints the the static dependencies of the enqueued script modules using

print_import_map()
void

Prints the import map using a script tag with a type="importmap" attribute.

get_import_map()
array

Returns the import map array.

get_marked_for_enqueue()
array[]

Retrieves the list of script modules marked for enqueue.

get_dependencies()
array[]

Retrieves all the dependencies for the given script module identifiers,

Parameters: $ids: array, $import_types: array
get_src()
string

Gets the versioned URL for a script module src.

Parameters: $id: string
print_script_module_data()
void

Print data associated with Script Modules.

print_a11y_script_module_html()
void

No description available.

Properties

Property / Type Description
$registered
mixed
public
No description available.
$enqueued_before_registered
mixed
public
No description available.
$a11y_available
mixed
public
No description available.

Class Information

Since Version
6.5.0
Source File
wp-includes/class-wp-script-modules.php
Advertisement