menu
Menu
Drakon.Tech logo
Drakon.Tech
Get started
Drakon.Tech documentationProgramming in DRAKONThe basics of programming with Drakon.TechHello worldVariables and functionsif-else | Question iconswitch-case | the Choice iconThe foreach loopThe arrow (while) loopSilhouetteClassesLambdas and exceptionsAdvanced programming methodsGame examplesThe source codeLegacy tutorials (JavaScript 0.2)

Hello world

Ru | En

Source code: Hello world

How to make a minimal app in Drakon.Tech

  1. Create a module.

  2. Add a function to the module:

    • The name of the function should be main.
    • Check the export checkbox on the properties of the function.
  3. Create an application and add the module to the application.

Detailed instructions

  1. Create a module. Ensure the module's language is "JavaScript 1.0 (Holo)".
  2. Add a function to the module. Name the function main.
  3. Mark the main function as exported.
  4. Build the module.
  5. Create an application.
  6. Add the newly created module to the application on the "Modules" tab.
  7. Make the module startup. Save the app.
  8. Go to the "Application" tab and click on the "Run in the browser" link.

Step by step

Create a module.

Ensure the module's language is "JavaScript 1.0 (Holo)".

Add a function to the module. Name the function main. Mark the main function as exported.

Add some code to the function.

Build the module.

Create an application.

Add the newly created module to the application on the "Modules" tab. Make the module startup.

Go to the "Application" tab and click on the "Run in the browser" link.

Open the Developer tools in the browser and go to the Console. You will see the expected output there:

Hello, Drakon.Tech!

The application is not necessary

Strictly speaking, you can do without the application. You only need an application to run your code in the browser. If you want a JavaScript file, a module alone will suffice.

Let's create a module and call the module wow_0_1. Then, we add a function to the wow_0_1 module. Let's call the function foo. Finally, we export the function foo and build the module. Drakon.Tech will create a JavaScript file from the wow_0_1 module. You can now download the file and use it in your front-end application. Alternatively, you can include the JavaScript file in a NodeJS project.

This is how you use the wow_0_1 module in the code.

var wow = wow_0_1(); // Create an instance of the "wow_0_1" module.
wow.foo(); // Call the "foo" function.

Note that you can create as many instances of a module as you like.

In NodeJS, one needs a require statement like this one:

const wow_0_1 = require("./wow_0_1");

See also

Modules and dependencies

Source code: Hello world
close
Close
Drakon.Tech logo
Drakon.Tech home
Programming in DRAKONThe basics of programming with Drakon.TechAdvanced programming methodsThe source codeLegacy tutorials (JavaScript 0.2)