Script Block

v1.4.3

Members

(inner) Kitsi

Instance of the Kitsunei WebSDK. Please visit the SDK Reference page to read about the methods you can use.
NOTE: This is an instance, not the actual SDK constructor.

Methods

(inner) createOutput(name) → {module:Script.Output}

Creates a custom output that can be used to send data to Widgets.
Parameters:
NameTypeDescription
nameStringA custom name for the output. This name will appear as a data source when using widgets.
Example
var myOutput = createOutput('myCustomOutput');
myOutput.send(123);

(inner) getChildren(nameopt) → {Object|Array}

If called without an argument, it returns an Array that contains a list of all children currently attached to the block. If an argument is passed it returns an object that represents the requested child block.
Parameters:
NameTypeAttributesDescription
nameString<optional>
The name of the child block to get
Example
// Get all blocks
var listOfBlocks = getChildren();
listOfBlocks[0].actions.doSomething();  // Assumes the block has an action 'doSomething'

// Get a specific block
var myBlock = getChildren('Logic_1');
if(myBlock){
 myBlock.actions.doSomething()
}

Type Definitions

console :Object

Prints data to the console panel. To make the panel visible, click on the 'Console' button from the top of the window. Formatting options include:
% — yields a literal % character
b — yields an integer as a binary number
c — yields an integer as the character with that ASCII value
d or i — yields an integer as a signed decimal number
e — yields a float using scientific notation
u — yields an integer as an unsigned decimal number
f — yields a float as is; Use a . (dot) followed by a number to specify the precision
g — Same as f but the number after the . (dot) specifies the number of significant digits. 
    When used on a string, it causes the result to be truncated.
o — yields an integer as an octal number
s — yields a string as is
t — yields true or false
T — yields the type of the argument1
v — yields the primitive value of the specified argument
x — yields an integer as a hexadecimal number (lower-case)
X — yields an integer as a hexadecimal number (upper-case)
j — yields a JavaScript object or array as a JSON encoded string
Properties:
NameTypeDescription
logfunctionStandard log format
infofunctionBlue text
errorfunctionRed text
warnfunctionYellow text
Example
console.log("Simple output");
console.log("With format: [%s]", "inside brackets!");
console.info("A number: %d", 32);
console.warn("Something bad will happen!");
console.error("Something bad just happened :(");

Output :Object

Properties:
NameTypeDescription
sendfunctionFeeds the output. Any widget using this output as a data source will receive data.

BlockTypes :Object

Access to the WebSDK's BlockType object. From here you can access all the block serials.
Example
var tempSerial = BlockTypes.Temperature;     // 105