Configuration.export()
Description
Defines context variables that are accessible to other modules.
In PipyJS, context variables can be defined in two ways. One way is by pipy(), where the context variables are only visible to script in the same file. The other way is by using export(), where the context variables are not only visible to the file where they are defined, but also to other files that imported them with import().
Exported context variables must be under a namespace, which is referred to while being imported in other modules. Since exporting a context variable also defines it like with pipy(), you also give it an initial value.
Every call to export() exports multiple context variables to one namespace, with pairs of variable names and initial values given in an object as the second argument to the method. You can call export() more than once to export to multiple namespaces.
As a convention, exported variables are recommended to have two underscores as prefix, such as __targetFound.
Syntax
pipy().export(namespace, {contextVariable1: initialValue1,contextVariable2: initialValue2,contextVariable3: initialValue3,// ...})
Parameters
export(namespace, variables)
The namespace to refer when being imported in other modules.
An object containing key-value pairs of context variable names and their initial values.
The same Configuration object.
Example
pipy({_startupTime: Date.now(), // a global variable only visible to this file}).export('routing-stuff',{// global variables visible to other modules under namespace 'routing-stuff'__service: undefined,__target: undefined,})