This PR updates the script method that calls javascript and returns a response.
The current implementation strips away the simple possibility of the parent C API to check if the script has run successfully.
It re-implemets this possibility for the script method and makes it safer and simpler to use.
The only arguments for the method will be the java script code string
The params timeout and the response buffer size max_response_size (defaults to 8KiB) become optional.
// New default
resp := e.window.script('return count;')
// Instead of default
resp := e.window.script('return count;', 0, 4096)
// Now, if a timeout should be added
resp := e.window.script('return count;', timeout: 10)
It will return a ScriptResponse inspired by Vs builtin os.execute.
This contains a success and a output filed. It can be used with e.g. resp.success to check if it the script has run successfully and res.ouput to get the output.
This PR updates the script method that calls javascript and returns a response.
The current implementation strips away the simple possibility of the parent C API to check if the script has run successfully.
It re-implemets this possibility for the
script
method and makes it safer and simpler to use.timeout
and the response buffer sizemax_response_size
(defaults to 8KiB) become optional.ScriptResponse
inspired by Vs builtinos.execute
. This contains asuccess
and aoutput
filed. It can be used with e.g.resp.success
to check if it the script has run successfully andres.ouput
to get the output.