JavaScript¶
Test and debug JavaScript.
Testing scripts¶
In order to test functionality, the JavaScript engine can be called manually.
JavaScript sessions¶
See Debugging JavaScript on how to debug JavaScript scripts.
List all JavaScript sessions¶
- 
GET/javascript/session¶
- Retrieves the the current JavaScript sessions, their current status, and which port they listen to. - Produces: - text/plain – A textual list of the current JavaScript sessions in VidiCore, their current status, and which port they listen to
 - Role: - _administrator 
Note
Multiple JavaScript debug sessions cannot share the same port. If several JavaScript sessions are started simultaneously, each is allocate the next free port. The port number can be found using the request above.
Example¶
POST /javascript/test
Content-Type: application/javascript
1+1
GET /javascript/session
0    testscript      STARTED/RUNNING 0.0.0.0/0.0.0.0:59000   null
Retrieve a JavaScript session¶
- 
GET/javascript/session/(id)¶
- Retrieves stack trace of a specific JavaScript session. - Produces: - text/plain – The stack trace of the session
 - Status Codes: - 400 – The session has no frames
- 404 – No such session
 - Role: - _administrator 
Example¶
After having connected to the session:
GET /javascript/session
0    testscript      CONNECTED/SUSPENDED     0.0.0.0/0.0.0.0:59000   testscript-213efccdd3.js:2
GET /javascript/session/0
testscript-213efccdd3.js:2
Stop a JavaScript session¶
- 
DELETE/javascript/session/(id)¶
- Stops an active debugging session. - Query Parameters: - stop (boolean) – - true- Kill the running script.
- false(default) - Stop the debugging session, and leave the script running.
 
 - Status Codes: - 400 – If no such session could be found.
 - Role: - _administrator 
- stop (boolean) –