The JSMAs
What is a JSMA?
JSMAs (JavaScript Macro API) allow you to access external platform logic and data like request data, orders, Vouchers, session data and so on within WebMacros. JSMAs provide a facade to a locigal unit of external functionality.
How to use a JSMA in a WebMacro?
JSMAs are available in every webmacro without any further doing. So i.e. the JSMA files can be used any time in a WebMacro script like this:
... //retrieves a file content with the given uuid in the variable myFileUuid var myFile = files.findByUuid(myFileUuid); ...
Technically speaking JSMAs are a inversion of control concept where the platform container injects the instances into the script context before executing the WebMacro script.
Replacing JSMAs in global scope
JSMAs are regular variables which are present in global scope. So they can be replaced or overlayed by subscoping like any other global variable. You might want do this intentionally to extend or change a JSMAs functionality. But be aware of implications within the running context, as the JSMAs are just injected when creating a context.