You are not logged in.
Pages: 1
I have see the sample 22 about use of javscript with Mormot and this is clear enough.
However on my case I'd like to do the:
1. set from Delphi some Javascript variables value (float and integer);
2. run Javscript code;
3. get Javascrit variables value to use they on Delphi code.
On documentation I don't see nothing about variables transition.
What is the best approach for my goal?
regards
Offline
IIRC, although it's unclear about that, but actually sample 22 is outdated - it uses SpiderMonkey24 and it's deprecated by @MPV and their team.
The latest is the wrapper for SpiderMonkey52, you should look at <mORMot_root>\SyNode\Samples
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
The latest is the wrapper for SpiderMonkey52, you should look at <mORMot_root>\SyNode\Samples
There is a lot of confusion in this folder.
The examples are not very clear.
Offline
There is no "variables" in JavaScript. What you see as a variable is either a property of a global object (in case you wrote var myVar not inside the function) or a property of a hidden "scope variable object" (in case of var inside function or let inside block).
So to pass a "variable" into JS either pass it as a parameter to function or set as property of global object (or some member of global object). To get variable value back get a value of global object property with the same name as your variable (or create a function in JS what return your value)
Last edited by mpv (2018-12-10 16:53:30)
Offline
So to pass a "variable" into JS either pass it as a parameter to function or set as property of global object (or some member of global object). To get variable value back get a value of global object property with the same name as your variable (or create a function in JS what return your value)
I think I understand.
Please do some cleaning on <mORMot_root>\SyNode\Samples folder when you have time
Offline
You are right. This will be a good task for me on Christmas
If possible can you convert the sample 22 (based old spidermonkey implementation) because I have some problem to convert it to use it with the new implementation. Thanks.
Offline
Pages: 1