Interface ModuleManager
-
- All Known Implementing Classes:
ModuleManagerImpl
@UsesMappedConfiguration(JavaScriptModuleConfiguration.class) public interface ModuleManager
Responsible for managing access to the JavaScript modules. The configuration of the service allows overrides of the default search path; the configuration keys are module names, and the configuration values are theJavaScriptModuleConfiguration
definitions for those module names. This is primarily used to wrap non-AMD compliant libraries for use with RequireJS (via contributedJavaScriptModuleConfiguration
s).- Since:
- 5.4
- See Also:
ModuleConfigurationCallback
,AMDWrapper
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Resource
findResourceForModule(String moduleName)
Given a module name (which may be a path of names separated by slashes), locates the correspondingResource
.void
writeConfiguration(Element body, List<ModuleConfigurationCallback> moduleConfigurationCallbacks)
Invoked by the internalDocumentLinker
service to write the configuration for the module system into the page.void
writeInitialization(Element body, List<String> libraryURLs, List<?> inits)
Invoked by the internalDocumentLinker
service to write the initializations (as perJavaScriptSupport.require(String)
into the page; this occurs after the module infrastructure has been written into the page, along with the core libraries.
-
-
-
Method Detail
-
writeConfiguration
void writeConfiguration(Element body, List<ModuleConfigurationCallback> moduleConfigurationCallbacks)
Invoked by the internalDocumentLinker
service to write the configuration for the module system into the page.- Parameters:
body
-<body>
element of the page, to which new<script>
element(s) will be added.moduleConfigurationCallbacks
- a list ofModuleConfigurationCallback
s, which is used to customize the configuration before it is written.
-
writeInitialization
void writeInitialization(Element body, List<String> libraryURLs, List<?> inits)
Invoked by the internalDocumentLinker
service to write the initializations (as perJavaScriptSupport.require(String)
into the page; this occurs after the module infrastructure has been written into the page, along with the core libraries.- Parameters:
body
-<body>
element of the page, to which new<script>
element(s) will be added.libraryURLs
- additional libraries that should be dynamically loaded before evaluating the initsinits
- specify initialization on the page, based on loading modules, extacting functions from modules, and invoking those functions
-
findResourceForModule
Resource findResourceForModule(String moduleName)
Given a module name (which may be a path of names separated by slashes), locates the correspondingResource
. First checks for contributed shim modules, then searches for possible matches among the defined library names. As a special case, the folder name "app" is mapped to the application's package.- Parameters:
moduleName
- name of module to locate- Returns:
- corresponding resource, or null if not found
-
-