Control a local Node.js process from Max. Messages preceded bycontrol the lifecycle of the Node script (start to start, stop to stop). Other messages will be sent to the process directly.
Some Max patchers will want to do things that are difficult to do from Max. For example, it might be desirable to pull some data from a web address, then parse and analyze that data to generate synthesis parameters. Or, one might want to watch a local folder for files, triggering some action inside Max when the contents of that folder change. For these kinds of long-running tasks, which may require some kind of complex, persistent state, Node can be a very useful tool.
To communicate with Max, the Node script uses the "max-api" Node module. This set of functions simplifies the process of sending data between the Node application and Max. This API can attach handlers to Max messages; parse Max dictionaries into JSON objects; and read, update and set named dictionaries within Max. For examples on how to use this API, see the code examples included with the Node for Max package, as well as the API documentation at https://docs.cycling74.com/maxnode.docs/max-node-api/
Entry point for your Node application. Send node.script the message to start running this script.
args [16 atoms]
Arguments to be passed to the Node script on launch. Note that this attribute is only meaningful in conjunction with the autostart attribute. Otherwise, node.script will use the arguments supplied with the message.
Start the Node script automatically, without
When false (the default), messages from Node will be processed on the scheduler thread, at the same priority as other Max messages. Activating defer will move processing to the back of the low priority queue, same as the defer attribute on metro
node_bin_path [symbol] (default: )
Override the built in Node executable. Optional. Only use this attribute if you'd like to use a different Node executable from the one included with Max for Node (possibly you want to use an older version for compatibility reasons).
npm_bin_path [symbol] (default: )
Override the built in NPM executable. Optional. Only use this attribute if you'd like to use a different NPM executable from the one included with Max for Node (possibly you want to use an older version for compatibility reasons).
options [16 atoms]
Read only: 1 if there is a running Node process, 0 otherwise
True if node.script should relaunch the Node script automatically when the source file changes
Common Box Attributes
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background [int] (default: 0)
Adds or removes the object from the patcher's background layer.adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color [4 floats]
Sets the color for the object box outline.
Sets the type style used by the object. The options are:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
Sets the object's font.
Sets the object's font size (in points).
hidden [int] (default: 0)
Toggles whether an object is hidden when the patcher is locked.
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick [int] (default: 0)
Toggles whether an object ignores mouse clicks in a locked patcher.
JS Painter File
patching_rect [4 floats] (default: 0. 0. 100. 0.)
Sets the position and size of the object in the patcher window.
position [2 floats]
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation [int] (default: 0)
Sets whether an object belongs to the patcher's presentation.
presentation_rect [4 floats] (default: 0. 0. 0. 0.)
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect [4 floats]
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size [2 floats]
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor [4 floats]
Sets the color for the object's text in RGBA format.
Sets the justification for the object's text.
0 = 'left'
1 = 'center'
2 = 'right'
Messages beginning with the symbolare used to start, stop and query the Node process. The symbol following determines how the message will be handled. Subsequent arguments are passed to that handler, if applicable.
npm - Interface with the Node Package Manager (npm). If the node script is in a node package, then this message can be used to (for example) install module dependencies listed in package.json into node_modules. The npm message assumes that package.json is in the same folder as the script specified as the first argument to node.script. Symbols following npm will be sent as arguments to npm (for examplewill run `npm install`).
processStatus - Get a dictionary describing the status of the running Node process (if any)
reboot - Rarely used. Reboot the Node process manager if it has crashed.
running - Returns 1 if there is a running node process, and 0 otherwise
status - Returns a dictionary with information about the installed version of Node
start - Start running the Node script with the given (optional) arguments. Arguments followingwill be available as command line arguments to the Node script.
stop - Stop running the Node script