[Pas2js] Javascript import and export

Ng Pheng Siong ngps at objectmemetic.com
Mon Jul 5 08:23:11 CEST 2021


On Mon, Jul 05, 2021 at 05:44:22AM +0200, Michael Van Canneyt wrote:
> The plan is to translate the existing $linklib directive, like this one:
> 
> {$linklib atom}
> 
> to an import/require statement that will be prepended to the javascript file.
> There will be statements in the JS or system unit which will allow you
> retrieve the imported objects.
> 
> I will try to document in the WIKI what has been discussed, there is more
> than what I wrote here.

Sounds good!

> But if you want to use import statements already today, this is easily done.
> simply look at the demos for VSCode and Atom plugins. They just require a
> small js file which is prepended/appended to the compiler
> output, look for the packageglue.js file, which is appended with -Ja or
> prepended with -Ji.

And using -Ji for the import statements work!

> I have published the article I wrote about this technique for Blaise Pascal
> magazine. See here:
> https://www.freepascal.org/~michael/articles/index.html#atomvscode

The approach is well explained. Thanks for the hint. I look forward to
sharing how far I can go with pas2js and NativeScript.

Pheng


More information about the Pas2js mailing list