CloudinoJS Language Reference

Javier Solis edited this page Aug 2, 2016 · 10 revisions

CloudinoJS is a subset of JavaScript language based on TinyJS and ported to ESP8266 by Javier Solis

Currently CloudinoJS supports:

  • Variables, Arrays, Structures
  • JSON parsing and output
  • Functions
  • Objects with Inheritance (not fully implemented)

Global Objects

This section describe all the JavaScript standard built-in objects.

Value properties

These global properties return a simple value; they have no properties or methods.

  • undefined
  • null (literal)

Function properties

These global functions—functions which are called globally rather than on an object—directly return their results to the caller.

  • eval(text) // execute the given code
  • parseFloat(str)
  • parseInt(str)
  • reset() //Reset the JScript Engine
  • restart() //Reset the WiFI Cloud Connector
  • require(name) //Import module
  • print(text) //Print text to the Console

Fundamental objects

These are the fundamental, basic objects upon which all other objects are based.

  • Object
  • String
  • Array

Objects imported by require

  • Number
  • Math

Require Function

These section describe de functions that are imported using the function require


Cloudino.print(“Hello World”);
pinMode(1, OUTPUT);


  •,data) //Post Message to Server
  • Cloudino.localPost(topic, data, ip) //Post Message to Local IP
  • Cloudino.localBCPost(topic, data) //Post Message to Local Broadcast
  • Cloudino.print(txt) //Print text to server console
  • Cloudino.on(topic, funct) //Subscribe to server topic, func=function(msg){}
  • Cloudino.onLocal(topic, funct) //Subscribe to local topic, func=function(msg){}
  • Cloudino.onAny=funct //Subscribe to any topic, func=function(topic,msg){}
  • Cloudino.onLocalAny=funct //Subscribe to any local topic, func=function(topic,msg){}


  • HIGH=1;
  • LOW=0;
  • INPUT=0;
  • OUTPUT=1;
  • pinMode(pin,mode)
  • digitalWrite(pin,value)
  • digitalRead(pin)
  • analogRead()
  • analogWrite(pin,value)


  • Object.dump()
  • Object.clone()


  • Math.rand()
  • Math.randInt(min, max)


  • String.indexOf(search) // find the position of a string in a string, -1 if not
  • String.lastIndexOf(search) // find the last position of a string in a string, -1 if not
  • String.substring(lo,hi)
  • String.charAt(pos)
  • String.charCodeAt(pos)
  • String.fromCharCode(char)
  • String.split(separator)


  • Array.contains(obj)
  • Array.remove(obj)
  • Array.join(separator)


  • setInterval(funct,time_ms)
  • clearInterval(id)
  • setTimeout(funct,time_ms)
  • clearTimeout(id)


  • JSON.stringify(obj) // convert to JSON


  • Math.abs(a)
  • Math.round(a)
  • Math.min(a,b)
  • Math.max(a,b)
  • Math.PI()
  • Math.sqrt(a)


  • // Read DHT11 Temperature and Humidity sensor


  • HTTP.get(url) // Get http response from url, return String with the response or undefined if not success
  • HTTP.send(host,port,content) // Send http content to host and port, return String with the response or undefined if not success


This chapter documents all the JavaScript statements and declarations. For an alphabetical listing see the sidebar on the left.

Control flow


A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets.


Terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement.


Terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration.


An empty statement is used to provide no statement, although the JavaScript syntax would expect one.


Executes a statement if a specified condition is true. If the condition is false, another statement can be executed.


Evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.



Declares a variable, optionally initializing it to a value.

Functions and classes


Declares a function with the specified parameters.


Specifies the value to be returned by a function.



Creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.


Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.


Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.



User to import extended modules

Expressions and operators

This section documents all the JavaScript expressions and operators. For an alphabetical listing see the sidebar on the left.

Primary expressions

Basic keywords and general expressions in JavaScript.


The this keyword refers to the function's execution context.


The function keyword defines a function expression.


Array initializer/literal syntax.


Object initializer/literal syntax.

( )

Grouping operator.

Left-hand-side expressions Left values are the destination of an assignment.

Property accessors

Member operators provide access to a property or method of an object ( and object["property"]).


The new operator creates an instance of a constructor.

Increment and decrement

Postfix/prefix increment and postfix/prefix decrement operators.


Postfix increment operator.


Postfix decrement operator.

Unary operators

A unary operation is operation with only one operand.


The delete operator deletes a property from an object.


The unary plus operator converts its operand to Number type.


The unary negation operator converts its operand to Number type and then negates it.


Bitwise NOT operator.


Logical NOT operator.

Arithmetic operators

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.


Addition operator.


Subtraction operator.


Division operator.


Multiplication operator.


Remainder operator.

Relational operators

A comparison operator compares its operands and returns a Boolean value based on whether the comparison is true.


Less than operator.


Greater than operator.


Less than or equal operator.


Greater than or equal operator.

Note: => is not an operator, but the notation for Arrow functions.

Equality operators

The result of evaluating an equality operator is always of type Boolean based on whether the comparison is true.


Equality operator.


Inequality operator.


Identity operator.


Nonidentity operator.

Bitwise shift operators

Operations to shift all bits of the operand.


Bitwise left shift operator.


Bitwise right shift operator.

Binary bitwise operators

Bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard JavaScript numerical values.


Bitwise AND.


Bitwise OR.


Bitwise XOR.

Binary logical operators

Logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value.


Logical AND.


Logical OR.

Conditional (ternary) operator

(condition ? ifTrue : ifFalse) The conditional operator returns one of two values based on the logical value of the condition.

Assignment operators

An assignment operator assigns a value to its left operand based on the value of its right operand.


Assignment operator.


Multiplication assignment.


Division assignment.


Remainder assignment.


Addition assignment.


Subtraction assignment


Left shift assignment.


Right shift assignment.


Bitwise AND assignment.


Bitwise XOR assignment.


Bitwise OR assignment.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.