Tutorials Examples

Drakon.Tech JavaScript tutorial: modules for the browser, ES6, and CommonJS

How to make a JavaScript module

  1. Create a module in a Drakon.Tech project.
  2. Right-click on the module.
  3. Click on "Properties".
  4. Set the language to "JavaScript".
  5. Save the properties.
  6. Click the "Build" button on the top menu.

A Drakon.Tech module becomes a JS file, if the module language is "JavaScript."

How to change the module type

  1. Right-click on the module in Drakon.Tech.
  2. Click on "Properties".
  3. Set the "Module format".
  4. Save the properties.

Available module formats:

How to export a function

Put the "export" keyword in the first line of the "Parameters" icon.

This works for Factory, CommonJS, and ES6 module types.

Note: for IIFE module type, exported functions need to be manually saved in the global scope.

An exported function:

An exported function