Hello world
Ru | En
How to make a minimal app in Drakon.Tech
Create a module.
Add a function to the module:
- The name of the function should be main.
- Check the export checkbox on the properties of the function.
Create an application and add the module to the application.
Detailed instructions
- 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.
- Build the module.
- Create an application.
- Add the newly created module to the application on the "Modules" tab.
- Make the module startup. Save the app.
- 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");