Namespace
The concept of a namespace is already used in Campaign with regards to the database to protect your tables from conflicting with native ones if they share the same name. ACDF uses a similar concept with regards to Javascript.
The project namespace is essentially just an object which will serve as a container for your custom code. In order to avoid conflicts, you should always envelop your scripts in an IIFE and then assign those entities which you do want to use outside of a script to the namespace. See the section below on libraries for a more in-depth explanation.
Filenames
ACDF uses filenames to determine how a file should be processed.
Javascript
Format:{name}.{suffix}.js
The name can be anything you want it to be. The suffix will tell ACDF how to process your file during the build. Here is a breakdown of the different suffixes and what they represent:
Libraries
Libraries allow you to organise and/or reuse your code. In concept, it corresponds to the xtk:javascript entity in Campaign. A library should export the functions and objects which you want to use elsewhere by assigning them to your namespace.
For example, if you wanted to create a reusable function and call it in a workflow activity:
hello.library.js
(() => {
function helloWorld() {
logInfo("Hello world");
}
ACDF.helloWorld = helloWorld;
})();
hello.activity.js
(() => {
loadLibrary("acdf:hello.library.js");
ACDF.helloWorld();
})();
- `library`: This denotes a JS library which can be called via `loadLibrary()`. This corresponds to the `xtk:javascript` entity. You should use
- `activity`: This is JS activity in a workflow.
Examples:
- demo.library.js: A library to be loaded using loadLibrary() which provides a feature described by demo.
- dev.env.js