Hi
I have read the "introduction" to javascript for SimHubDash, but when I try to write things like "Class" definition or many other javascript code, it doesn't work despite I checked the code in a "code checker" that say it's properly written.
Is there any "Javascript for SimHubDash" documentation? or any other reference?
Thanks a lot for your help
Hi !
Indeed classes are not supported as they are ecma 2015 compliant while SimHub uses an ECMAScript 5.1 compliant engine.
All the ecmascript 5.1 rules applies in the engine.
If you want more details about the specific implementation in use in SimHub you can see the jint engine documentation : https://github.com/sebastienros/jint
The only specificity compared to classic javascript is that everything wrote in the script is wrapped with a function, then called at every loop :
Example
you write :
return 'a';
Simhub will wrap automatically everything with a function, then call it
simhubgeneratedfunction(){
return 'a';
}
That structure is indeed made for simple javascript data processing but is not really intended for writing a full program with classes etc ...
Ok, that helps a lot to reduce the time trying "impossible things" 🙂
Thanks a lot!
Hi !
Indeed classes are not supported as they are ecma 2015 compliant while SimHub uses an ECMAScript 5.1 compliant engine.
All the ecmascript 5.1 rules applies in the engine.
If you want more details about the specific implementation in use in SimHub you can see the jint engine documentation : <a href=" removed link "> removed link
The only specificity compared to classic javascript is that everything wrote in the script is wrapped with a function, then called at every loop :
Example
you write :
return 'a';Simhub will wrap automatically everything with a function, then call it
simhubgeneratedfunction(){
return 'a';
}
That structure is indeed made for simple javascript data processing but is not really intended for writing a full program with classes etc ...
okay, your answer is really detailed and easy to understand. It helped me when I wanted to learn about javascript documentation