You can use custom AMD (Asynchronous Module Definition)
modules in your coach views.
About this task
IBM® Business
Process Manager includes
the
Dojo 1.8.6 AMD loader.
With this loader, you can package custom AMD modules and then register
a dependency on those modules in your coach view. Registering a module
involves assigning an alias for the module because the coach view
accesses the module by using its alias.
Procedure
- Prepare your AMD package:
- Package your AMD modules in a .zip file
such as myPackage.zip.
- Upload that .zip file as a managed
web file.
- Create a JavaScript file
to define the package map for your AMD modules. For
example, create the myPackageMap.js file and
add the following package map code for AMD modules that are called myModule and myOtherModule:
require({
packages: [
{name: 'myModule', location: com_ibm_bpm_coach.getManagedAssetUrl('myPackage.zip',
com_ibm_bpm_coach.assetType_WEB, 'PROJECT') + "/path/to/myModule"}
{name: 'myModule', location: com_ibm_bpm_coach.getManagedAssetUrl('myPackage.zip',
com_ibm_bpm_coach.assetType_WEB, 'PROJECT') + "/path/to/myOtherModule" }
]
});
The PROJECT parameter contains the
acronym or short name of the process application or toolkit that contains
the .zip file. If the module is in the current
process application, the PROJECT parameter
is optional. If the module is in a referenced toolkit, you must include
the PROJECT parameter to ensure that the coach
view can use module in the context of the process application.
If the class for the AMD module is at the root of the managed web
file, do not include the /path/to/myModule parameter.
The /path/to/myModule is the path in the .zip file
to the AMD module class.
- On the Behavior page of your coach
view, add the JavaScript file
as an included script.
- Register each AMD module in your coach view:
- On the Behaviorr page of the coach
view, select AMD dependencies.
- Click Add and then specify the
following information:
- In the Module ID column, declare the dependency
on the AMD module by using a path like myPackage/path/to/myModule.
- In the Alias column, type the alias that
you use in the code to refer to the module.
- In your coach view code, use the alias to access the functions
of the AMD module.