- Source:
numrange: return a range of numbers quickly based on http://rosettacode.org/wiki/Map_range#JavaScript
Namespaces
Members
(static, constant) CodeEditor
- Source:
CodeMirror code editor instance (local code). See https://codemirror.net/doc/manual.html
(static, constant) commandHandler
- Source:
json-rpc gcode event handler
(static, constant) errorHandler
- Source:
json-rpc error event handler
(static) exList
- Source:
build examples loader links for dynamically loading example files
(static, constant) infoHandler
- Source:
json-rpc error event handler
(static, constant) okHandler
- Source:
json-rpc ok event handler
(static, constant) portsListHandler
- Source:
json-rpc serial ports list event handler
(static) socketHandler
- Source:
Handle websockets communications and event listeners
(static, constant) stripComments
- Source:
Strip GCode comments from text. Comments can be embedded in a line using parentheses () or for the remainder of a lineusing a semi-colon. The semi-colon is not treated as the start of a comment when enclosed in parentheses. Borrowed from https://github.com/cncjs/gcode-parser/blob/master/src/index.js (MIT License) See http://linuxcnc.org/docs/html/gcode/overview.html#gcode:comments
(static, constant) tempHandler
- Source:
json-rpc temperature event handler
(inner) scope
- Source:
Global namespace for all printer functions. See globalEval
Methods
(static) appendLoggingNode(elem, time, message)
- Source:
Append a dismissible, styled text node to one of the side menus, formatted appropriately.
Parameters:
Name | Type | Description |
---|---|---|
elem |
jQuery | JQuery element to append this to |
time |
Number | Time of the event |
message |
String | message text for new element |
(static) blinkElem($elem, speed, callback)
- Source:
blink an element using css animation class
Parameters:
Name | Type | Description |
---|---|---|
$elem |
JQuery | element to blink |
speed |
String | "fast" or "slow" |
callback |
function | function to run at end |
(static) codeToJSON(gcode) → {string}
- Source:
Convert code to JSON RPC for sending to the server.
Parameters:
Name | Type | Description |
---|---|---|
gcode |
string | to convert |
Returns:
json message
- Type
- string
(static) doError(e)
- Source:
- See:
Show an error in the HTML GUI
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | Standard JavaScript error object to show |
(static) getSerialPorts()
- Source:
Get the list of serial ports from the server (or refresh it) and display in the GUI (the listener will take care of that)
(static) globalEval(code, line, globally)
- Source:
Evaluate the code in local (within closure) or global space according to the current editor mode (javascript/python).
Parameters:
Name | Type | Default | Description |
---|---|---|---|
code |
string | to evaluate |
|
line |
integer | line number for error displaying |
|
globally |
Boolean |
false
|
true if executing in global space, false (normal) if executing within closure to minimise side-effects |
(static) queueGCode(gcode)
- Source:
queue to be run after OK -- for movements, etc. only if necessary... send if nothing is already in the queue
Parameters:
Name | Type | Description |
---|---|---|
gcode |
string | to send |
(static) runCode()
- Source:
This function takes the highlighted "local" code from the editor and runs the compiling and error-checking functions.
(static) scope.mousemove(func, minDelta)
- Source:
Example
Example in use:
s.mousemove( function(e) {
console.log(e);
console.log((e.x-e.px) + "," + (e.y-e.py));
}, 20);
Parameters:
Name | Type | Description |
---|---|---|
func |
function | function to run when mouse moved |
minDelta |
any | minimum mouse distance, under which the function won't be run |
(static) sendGCode(gcode)
- Source:
Send GCode to the server via websockets.
Parameters:
Name | Type | Description |
---|---|---|
gcode |
string | gcode to send |
(static) setLanguageMode()
- Source:
Toggle the language mode for livecoding scripts between Javascript and Python.
(static) storageAvailable(type) → {Boolean}
- Source:
- See:
Local Storage for saving/loading documents. Default behaviour is loading the last edited session.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | type (global key in window object) for storage object |
Returns:
true or false, if storage is available
- Type
- Boolean
(static) updateTemperature(state, interval)
- Source:
Function to start or stop polling for temperature updates
Parameters:
Name | Type | Default | Description |
---|---|---|---|
state |
Boolean | true if starting, false if stopping |
|
interval |
Integer |
5000
|
time interval between updates |