Elgg  Version 6.3
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, protected ExternalFiles $externalFiles, protected Config $config)
 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
Examples
/root/Elgg/engine/classes/Elgg/FormsService.php.

Definition at line 16 of file ESMService.php.

Constructor & Destructor Documentation

◆ __construct()

Elgg\Javascript\ESMService::__construct ( protected ViewsService  $views,
protected SimpleCache  $cache,
protected ExternalFiles  $externalFiles,
protected Config  $config 
)

Constructor.

Parameters
ViewsService$viewsViews service
SimpleCache$cacheSimple cache
ExternalFiles$externalFilesExternal files
Config$configConfig

Definition at line 30 of file ESMService.php.

Member Function Documentation

◆ getImportMapData()

Elgg\Javascript\ESMService::getImportMapData ( )

Returns the importmap data.

Returns
array

Definition at line 43 of file ESMService.php.

◆ getImports()

Elgg\Javascript\ESMService::getImports ( )

Returns all modules that requested to be loaded.

Returns
array

Definition at line 100 of file ESMService.php.

◆ import()

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 91 of file ESMService.php.

◆ register()

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 80 of file ESMService.php.

Member Data Documentation

◆ $imports

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

Definition at line 18 of file ESMService.php.

◆ $runtime_modules

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

Definition at line 20 of file ESMService.php.


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