public class AMDWrapper extends Object
This is an alternative to configuring RequireJS module shims for the libraries. As opposed to shimmed libraries, the modules created using the AMDWrapper can be added to JavaScript stacks.
If the library depends on global variables, these can be added as module
dependencies. For a library that expects jQuery to be available as
$
, the wrapper should be setup calling
require("jQuery", "$")
on the respective wrapper.
JavaScriptModuleConfiguration
,
ModuleManager
Constructor and Description |
---|
AMDWrapper(Resource resource) |
Modifier and Type | Method and Description |
---|---|
JavaScriptModuleConfiguration |
asJavaScriptModuleConfiguration()
Return this wrapper instance as a
JavaScriptModuleConfiguration ,
so it can be contributed to the ModuleManager 's configuration. |
AMDWrapper |
require(String moduleName)
Add a dependency on another module.
|
AMDWrapper |
require(String moduleName,
String parameterName)
Add a dependency on another module.
|
AMDWrapper |
setReturnExpression(String returnExpression)
Optionally sets a return expression for this module.
|
public AMDWrapper(Resource resource)
public AMDWrapper require(String moduleName, String parameterName)
moduleName
- the name of the required module, e.g. jQuery
parameterName
- the module's corresponding parameter name of the factory
function, e.g. $
public AMDWrapper require(String moduleName)
moduleName
- the name of the required module, e.g.
bootstrap/transition
public AMDWrapper setReturnExpression(String returnExpression)
returnExpression
- the expression that is returned from this module (e.g.
Raphael
)public JavaScriptModuleConfiguration asJavaScriptModuleConfiguration()
JavaScriptModuleConfiguration
,
so it can be contributed to the ModuleManager
's configuration.
The resulting JavaScriptModuleConfiguration
should not be
changed.JavaScriptModuleConfiguration
for this AMD wrapper${project.version} - Copyright © 2003-2014 The Apache Software Foundation.