Hello,
Modern javascript has the possibility to import other modules:
import { create, createReportList } from './modules/canvas.js';
import * as Square from './modules/square.js';pas2js now supports the latter form of the import syntax. We re-use the $LINKLIB directive from FPC for this.
{$linklib ./modules/square.js}will be converted to
import * as square from './modules/square.js';or
{$linklib ./modules/square.js mysquare}
import * as mysquare from './modules/square.js';There are 4 demos that show how to use the importer libraries.
Some more explanations can be found in:
https://wiki.freepascal.org/pas2js_modules
The demos can be browsed at:
https://gitlab.com/freepascal.org/fpc/pas2js/-/tree/main/demo/modules
The next step is the creation of modules using the "library" concept of object pascal.
Michael.
