Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...
roNodeJs
6min
ronodejs is a brightscript object that allows the launching of a node js® instance these node js instances will have access to all brightsign node js modules as built in modules ronodejs also provides mechanisms to communicate between javascript and brightscript environments for more complex applications object creation ronodejs is instantiated with a filename and optional parameters node = createobject("ronodejs", "index js", {message port\ my message port, arguments \["arg1", "arg2"]}) in os 8 2 17 and later versions, you can also pass an optional node arguments parameter which provides arguments to the node interpreter itself (as opposed to arguments which provides arguments to the javascript application being run inside node) node = createobject("ronodejs", "index js", {message port\ my message port, node arguments \["arg"], arguments \["arg1", "arg2"]}) message port optional allows communication with javascript applications arguments optional passes arguments to the node instance node arguments optional passes arguments to the node js executable, for example, to enable remote inspector for node js node arguments can take multiple arguments env vars optional passes environment variables (supplied as an associative array) to the node js application note environment variable names are case sensitive, but roassociativearray is case insensitive by default and the brightscript literal syntax for associative arrays forces all key names to lower case to ensure correct behavior, call setmodecasesensitive() and use the addreplace() method to add variables to the array or you can use the following example, which is slightly less verbose than addreplace() a={} a setmodecasesensitive() a\["key"] = 1 a\["key"] = 2 print a ' returns both key and key postjsmessage() postjsmessage (data as associativearray) as boolean posts a collection of key\ value pairs to the brightscript messageport javascript class this method takes an associative array but it doesn't support nested associative arrays see messageport docid 5lt7hkssemqlniau7kva3 for more details ronodejs events see ronodejsevent docid 7nvhxjmwlbcii8dx4a4p3 for information about ronodejs events examples to enable inspector using node arguments node js = createobject("ronodejs", "main js", {message port msgport, node arguments \[" inspect=0 0 0 0 2999"], arguments \["node application argument1", "node application argument2"}) to change a directory to the directory of the current javascript file proc chdir( dirname) to set a timer to stop node from exiting setinterval(function(){console log("ping"}, 10000) to pass arguments to ronodejs node = createobject("ronodejs", "index js", {node arguments \[" r", "dotenv/config"], arguments \["dotenv config path=/storage/sd/ env"]}) note that "node arguments" are arguments that come before the filename, while "arguments" come after the filename