javascript document...
 
Notifications
Clear all

javascript documentation

4 Posts
3 Users
1 Reactions
5,881 Views
(@roller-inside)
Active Member
Joined: 5 years ago
Posts: 9
Topic starter  

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


   
Quote
(@admin5435)
Prominent Member Admin
Joined: 7 years ago
Posts: 736
 

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 ...


   
carluz reacted
ReplyQuote
(@roller-inside)
Active Member
Joined: 5 years ago
Posts: 9
Topic starter  

Ok, that helps a lot to reduce the time trying "impossible things" 🙂 

Thanks a lot!


   
ReplyQuote
(@andreps)
New Member
Joined: 11 months ago
Posts: 1
 

Posted by: @admin5435

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

 

This post was modified 11 months ago 3 times by andreps

   
ReplyQuote
Share: