Elgg  Version master
Public Member Functions | Protected Attributes | List of all members
Elgg\Javascript\ESMService Class Reference

Keeps track of ES modules. More...

Public Member Functions

 __construct (protected ViewsService $views, protected SimpleCache $cache)
 Constructor. More...
 
 getImportMapData ()
 Returns the importmap data. More...
 
 register (string $name, string $href)
 Registers a module to the import map. More...
 
 import (string $name)
 Request a module to be loaded on the page. More...
 
 getImports ()
 Returns all modules that requested to be loaded. More...
 

Protected Attributes

array $imports = []
 
array $runtime_modules = []
 

Detailed Description

Keeps track of ES modules.

Since
6.0

Definition at line 14 of file ESMService.php.

Constructor & Destructor Documentation

Elgg\Javascript\ESMService::__construct ( protected ViewsService  $views,
protected SimpleCache  $cache 
)

Constructor.

Parameters
ViewsService$viewsViews service
SimpleCache$cacheSimple cache

Definition at line 26 of file ESMService.php.

Member Function Documentation

Elgg\Javascript\ESMService::getImportMapData ( )

Returns the importmap data.

Returns
array

Definition at line 37 of file ESMService.php.

Elgg\Javascript\ESMService::getImports ( )

Returns all modules that requested to be loaded.

Returns
array

Definition at line 80 of file ESMService.php.

Elgg\Javascript\ESMService::import ( string  $name)

Request a module to be loaded on the page.

Parameters
string$namename of the module
Returns
void

Definition at line 71 of file ESMService.php.

Elgg\Javascript\ESMService::register ( string  $name,
string  $href 
)

Registers a module to the import map.

Parameters
string$namename of the module
string$hreflocation from where to download the module (usually a simplecache location)
Returns
void

Definition at line 60 of file ESMService.php.

Member Data Documentation

array Elgg\Javascript\ESMService::$imports = []
protected

Definition at line 16 of file ESMService.php.

array Elgg\Javascript\ESMService::$runtime_modules = []
protected

Definition at line 18 of file ESMService.php.


The documentation for this class was generated from the following file: