DRAKON.SU
https://forum.drakon.su/

Modules for the browser
https://forum.drakon.su/viewtopic.php?f=218&t=6557
Страница 1 из 1

Автор:  Владимир Паронджанов [ Четверг, 16 Май, 2019 13:26 ]
Заголовок сообщения:  Modules for the browser

Modules for the browser,
ES6, and CommonJS
(Drakon.Tech JavaScript tutorial)


https://www.youtube.com/watch?time_cont ... R0Xd-3V4Do

Цитата:
DRAKON Visual Language
Опубликовано: 11 мая 2019 г.

How to organize JavaScript code with modules of different types:
- CommonJS
- ES6
- Factory functions
- IIFE

https://drakon.tech/
Examples:
https://app.drakon.tech/ide/doc/examp...

Цитата:
How to make a JavaScript module
Create a module in a Drakon.Tech project.
Right-click on the module.
Click on "Properties".
Set the language to "JavaScript".
Save the properties.
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
Right-click on the module in Drakon.Tech.
Click on "Properties".
Set the "Module format".
Save the properties.
Available module formats:

IIFE - immediately invoked function expression
Factory
CommonJS
ES6
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:

Страница 1 из 1 Часовой пояс: UTC + 3 часа
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/