Task Development

Learn how to code DEX8 Tasks

Function Files

File "main.js" requires other files which will be used in the process (see example).
The functions can have different purposes in data extraction workflow.
For example:

  • function0 - connect to the database
  • function1 - open home page
  • function2 - login
  • function3 - go to specific web page
  • function4 - extract data
  • function5 - save data to the database
  • function6 - logout
  • function7 - disconnect from the database

  • ... repeat 3,4 and 5 until some condition, then logout

Function arguments

The function files are Javascript functions with two arguments x and lib.
For example:

module.exports = (x, lib) => {
  lib.echo.log('f1::', x);
  return x;

Argument "x" is the input which is modified by every function. It enters into function, modifies and outputs from one function to the next function. Thus, it goes through every function and returns as output in the main function. Every function must return argument "x" into the next function. As such we can call it a transitional or contextual argument.

Opposite to argument "x" is argument "lib". This argument contains helper libraries and functions shouldn't modify it.
To add a new library to this argument use the FunctionFlow libAdd() method in main.js file as it is done in this example. Besides this, libAdd(lib), libInject(lib), libRemove() and libList() can be used.