Class: Tinkamo

Tinkamo()

**Class for all Tinkamo** Essentially a bucket containing all Tinkamo and functions handling when TinkaCores are connected and disconnected to the browser. There should only be one instance of Tinkamo per application.

Constructor

new Tinkamo()

Creates an instance of the Tinkamo class.
Source:

Methods

addEventListener(eventType, func, …args) → {boolean}

Function allowing the user to define custom event listeners to be called when a Tinkamo instance triggers an event. Events are called in the order with which they were added. eventType must be one of the following: - '*' - connect or disconnect - 'connect' - 'disconnect'
Parameters:
Name Type Attributes Description
eventType string
func function
args * <repeatable>
Source:
Returns:
Type
boolean

connect()

Primary method for connecting a new TinkaCore to the browser using the Chrome bluetooth api. Due to browser security, this function cannot be called directly, and instead must be a called from user action like pressing a button.
Source:
Example
let tinkamo = new Tinkamo();
let connectionButton = document.getElementById('connectionButton');
connectionButton.onclick = function() { tinkamo.connect(); }

getByID() → {Tinkacore}

Gets a tinkacore based on its built-in ID
Source:
Returns:
Type
Tinkacore

getByName() → {Tinkacore}

Returns a list of tinkacores with included name. Empty list if the name is not found
Source:
Returns:
Type
Tinkacore

getBySensor() → {Tinkacore}

Returns a list of tinkacores with currently attached top. Empty list if none have that top.
Source:
Returns:
Type
Tinkacore

getTinkamoList(include_disconnectedopt) → {Array.<Tinkacore>}

Get a list of TinkaCores. By default it returns tinkacores that have been disconnected as well. TinkaCores are listed in the order with which they were originally connected.
Parameters:
Name Type Attributes Default Description
include_disconnected boolean <optional>
true
Source:
Returns:
Type
Array.<Tinkacore>

removeEventListener(eventType, func) → {boolean}

Removes a callback function from the events list preventing further calls.
Parameters:
Name Type Description
eventType string
func function
Source:
Returns:
Type
boolean