Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2020-05

Improved JS-Object to class demo

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

I have improved the Javascript Object-to-Pascal class demo somewhat.

It no longer requires you to recompile the demo, everything can be done dynamically.

Check it out:

https://www.freepascal.org/~michael/pas2js-demos/genclass/

You can load scripts dynamically
(every URL you type can be loaded with "Load Script");

You can give:
- a path to an object instance (relative to the window instance).
- a pascal class name for the new external definition.
- an external name for the new external definition.
- the parent name for the new external class (by default TJSObject)

When you hit 'Create class', a skeleton pascal code will be generated for you.

For instance, load the following script:

https://uselooper.com/assets/javascript/theme.min.js

Then enter
Object path: Looper
Pascal external class name: Theme
Pascal Class Name : TJSLooper

Hit "Create class" and observe your new external class definition... The code is of course not perfect, but will help you getting started.

Code is obviously committed in the demos. Suggestions for improvements welcome.

Enjoy !

Michael.

Reply by email