classafDuvet::ScriptModule

sys::Obj
  afDuvet::ScriptModule

Module configuration for those that do not conform to AMD specification. Contribute instances to ScriptModules. Example:

@Contribute { serviceType=ScriptModules# }
static Void contributeScriptModules(OrderedConfig config) {
    jqueryModule := ScriptModule("jquery").atUrl(`/scripts/jquery-2.1.1.min.js`).exports("jQuery") 
    config.add(jqueryModule)
}

ScriptModule instances are used to create a 'shim' for RequireJS modules.

atUrl

Source

This atUrl(Uri moduleUrl)

If the module can not be found under the baseUrl then this dictates where it can be downloaded from. May be an external or local URL.

exports

Source

This exports(Str exports)

The name of a global variable exported by the module. This will be the value injected into modules that depend on the shim.

fallbackToUrl

Source

This fallbackToUrl(Uri moduleUrl)

Dictates an alternative location for the module should the primary download fail. May be an external or local URL.

initWith

Source

This initWith(Str expression)

An alternative to exports, this allows the module to be initialised with a short expression.

@see http://requirejs.org/docs/api.html#config-shim for details.

make

Source

new make(Str moduleId)

Creates a ScriptModule for the given moduleId.

requires

Source

This requires(Str moduleIds)

A list of other module names the shim depends on. Multiple module names should be split by whitespace. Example:

ScriptModule("myModule").requires("jquery bootstrap")