Custom modules
Modules
A module is a named library of reusable functions, types and values. You can create your own modules from the Hub and consume them in your applications.
Modules are only allowed to declared functions, types and values.
Given such a module, we can use it in a script step:
Assertions
While developing a module, it is often useful to investigate the behavior of its functions before consuming them in an application. You can do this using assertions.
An assertion is a statement indicating what you expect to be true about a function. Similar to a unit test in other programming environments, an assertion can be checked while the code is being developed.
To check the assertions in a module, press the Check Assertions button above the module editor. Assertions which evaluate to true are considered successful; assertions which evaluate to false (or raise a runtime error) are considered failed. The success or failure of each individual assertion will be indicated by a green check mark or a red cross, respectively, next to the line.
When applications are run, assert statements are ignored.
Making use of assertions is a highly recommended practice, as they help verify that the code in the modules retains its expected behavior as you continue to work on it.
Private
Functions and values in modules can be marked as private. A private function or value can be used by other functions and values inside the module but are not visible to applications that use the modules.
A private function or value is declared by adding the private
keyword before the function
or let
keywords.
FlowScript Playground
All modules that are open in the Designer are automatically made available in the FlowScript Playground. The Playground will use the current version of the module, regardless of whether it is saved.
Last updated