Class JavaScriptModuleConfiguration
-
- org.apache.tapestry5.services.javascript.JavaScriptModuleConfiguration
-
public final class JavaScriptModuleConfiguration extends
Used to define a , used to adapt non-AMD JavaScript libraries to operate like proper modules. This information is used to build up a list of dependencies for the contributed JavaScript module, and to identify the resource to be streamed to the client. Instances of this class are contributed to theModuleManager
service; the contribution key is the module name (typically, a single word). In some cases, an instance may be created and contributed to override a default module; if the module has no dependencies, exports, or initExpression (that is, if it is a proper AMD module, where such dependencies are provided inside the module itself), then no client-side shim configuration will be written for the module, but requests for the module will be satisfied by the resource.'- Since:
- 5.4
- See Also:
AMDWrapper
-
-
Constructor Summary
Constructors Constructor Description JavaScriptModuleConfiguration(Resource resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaScriptModuleConfiguration
... moduleNames)
A list of other module names the shim depends on.JavaScriptModuleConfiguration
exports)
The name of a global variable exported by the module.<>
getDependencies()
getExports()
getInitExpression()
boolean
getNeedsConfiguration()
Returns true if the module contains any additional configuration beyond itsResource
.JavaScriptModuleConfiguration
expression)
Used as an alternative to exports(String), this allows a short expression to be specified; the expression is used to initialize, clean up, and (usually) return the module's export value.
-
-
-
Constructor Detail
-
JavaScriptModuleConfiguration
public JavaScriptModuleConfiguration(Resource resource)
-
-
Method Detail
-
dependsOn
public ... moduleNames)
A list of other module names the shim depends on.- Parameters:
moduleNames
-- Returns:
- this JavaScriptModuleConfiguration for further configuration
-
getDependencies
public <> getDependencies()
-
exports
public exports)
The name of a global variable exported by the module. This will be the value injected into modules that depend on the shim.- Returns:
- this JavaScriptModuleConfiguration for further configuration
-
getExports
public getExports()
-
initializeWith
public expression)
Used as an alternative to exports(String), this allows a short expression to be specified; the expression is used to initialize, clean up, and (usually) return the module's export value. For Underscore, this would be "_.noConflict()". If the expression returns null, then the exports value is used. In RequireJS 2.1.1 (the version shipped with Tapestry, currently), an init function is not invoked unless the shim also defines an exports. See . At this time, you should specifyexports
even if you provide ainitializeWith(String)
}.- Parameters:
expression
- initialization expression- Returns:
- this JavaScriptModuleConfiguration, for further configuration
-
getInitExpression
public getInitExpression()
-
getNeedsConfiguration
public boolean getNeedsConfiguration()
Returns true if the module contains any additional configuration beyond itsResource
.
-
-