Have any questions?

+44 (20) 3540 6226

hello@appshed.com

app (Class)

app Class

Defined in: app.js:108

The main object that contains everything that you use in app.js

Constructor

app

()

Defined in app.js:108

 

Item Index

Methods

Properties

Methods

...

(
  • styleDescriptor
  • Name...
)
... Object

Defined in app.js:988

Add styleDescriptor CSS styles to the document head.

Parameters:

  • styleDescriptor ... String

    Describe.../** ...

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns this.

Example:

paste example here

_call_initScreen

()

Defined in app.js:377

Repeatedly try call _initScreen on error.

_init

()

Defined in app.js:215

Initialises app.js on startup. A number of setup procedures are called. This is a Private method and should not be called by the user.

_init2

()

Defined in app.js:309

Some init tasks can only be done once jQuery loaded.

_initScreen

(
  • id
  • el
)

Defined in app.js:397

Initilisation of each screen on load.

Parameters:

  • id Int
     
  • el String
     

_initTab

(
  • id
  • el
)

Defined in app.js:443

 

Parameters:

  • id Number

    Describe...

  • el String

    Describe...

addAction

(
  • idOrClassName
  • handler
)
... Object

Defined in app.js:485

Adds an action handler for idOrClassName. Multiple actions can be added for each idOrClassName. The Item does not need to exist on the current screen. i.e. this method can be called on init.

Parameters:

  • idOrClassName String

    Describe...

  • handler ...

    Describe...

Returns:

... Object:

Returns this.

addActions

(
  • arr
)
... Object

Defined in app.js:456

Adds actions to Items.

Parameters:

  • arr ... String

    arr is an Array of descriptors in the format:

Returns:

... Object:

Returns this. arr = [ { idOrClassName: "" , actionType: "", handler: [ad-hoc function] } ] idOrClassName - this can be the itemId, the DOM id or a Classname for the item

addClass

(
  • className
)
... Object

Defined in app.js:664

Adds className to the app element.

Parameters:

  • className ... String

    Describe...

Returns:

... Object:

Returns this.

addCoreStyles

() ... Object

Defined in app.js:513

Add the core styles to the page These can be used in the Custom Class field of the Styles tab for tabs, screens and items.

Returns:

... Object:

Returns this.

addCSS

(
  • url
)
...

Defined in app.js:684

Loads url as a CSS file to the page

Parameters:

  • url ... String

    Describe...

Returns:

...:

Describe...

addDevice

(
  • props
)
...

Defined in app.js:699

adds an IoT Device (such as ESP8266, RaspberryPi or Arduino) to this app.

Parameters:

  • props ... String

    props is a JSON object containing the properties of the device.

Returns:

...:

Returns device.

addHoverImages

(
  • imageArray
)
... String

Defined in app.js:737

Adds hover images that appear when the user hovers over the Item. Works with touch and mouse events

Parameters:

  • imageArray ... String

    imageArray is an array of objects in the format.

Returns:

... String:

Returns this.

Example:

[ { id: id, class: className, url: imageURL, doActions: true|false }, ...

addInterval

(
  • identifier
  • name
)
...Number

Defined in app.js:794

Adds an interval handler identifier to the _intervals.

Parameters:

  • identifier ... Number

    Describe...

  • name ... String

    Describe...

Returns:

...Number:

Returns identifier. paste example here

addJQueryScripts

() ...

Defined in app.js:820

Adds the script tags required for jQuery to the <head>. This method is called on an Interval until all the scripts required have been loaded. Once all the script are loaded, the Interval is stopped.

Returns:

...:

Returns ...

addScreenClickHandlers

(
  • id
  • el
)
... Object

Defined in app.js:882

Adds the event handlers to the Screen to capture click events.

Parameters:

  • id ... Number

    Describe...

  • el ... String

    Describe...

Returns:

... Object:

Returns this.

addScreenEvent

(
  • id
  • func
)
...

Defined in app.js:908

This function returns an identifier.

Parameters:

  • id ... Number

    id can be the Screen.id or the Screen ClassName.

  • func ... String

    The given func will be called whenever the screen id is shown.

Returns:

...:

Returns ...

Example:

app.addScreenEvent(17078, function() {
    app.getScreen(this).setBackgroundColor("Blue")
});

addScript

(
  • code
  • callback
)

Defined in app.js:961

Loads the JavaScript content script into the page. If script holds a url, passes this to app.loadScript().

Parameters:

  • code ... String

    Describe...

  • callback ... String

    Describe...

addTabEvent

(
  • id
  • func
)
... Object

Defined in app.js:1021

This function returns an identifier.

Parameters:

  • id ...Number

    id can be the Tab.id or the Tab ClassName.

  • func ...String

    The given func will be called whenever the Tab id is shown.

Returns:

... Object:

Returns this.

addVariableEvent

(
  • id
  • func
)
... Object

Defined in app.js:1061

The given func will be called whenever the Variable id is changed.

Parameters:

  • id ...Number

    Describe...

  • func ...String

    Within func, this will refer to the Element of the Tab that is shown.

Returns:

... Object:

Returns this.

Example:

There are two parameters: val and app. /* ` app.addVariableEvent('textbox', function(val) { var t = document.getElement('#screen17078 .title span'); if(t) { t.set('text', val); } }); `

alertPinValue

(
  • idOrProps
  • pin
  • format
)
... Object

Defined in app.js:1125

Shows a screen alert message with the value of the pin for the device idOrProps.

Parameters:

  • idOrProps ...Number

    Describe...

  • pin ...Number

    Describe...

  • format ...String

    Optional format can be a (for analog) or d (for digital) value (Default: d).

Returns:

... Object:

Returns this.

analogRead

(
  • pin
  • callback
  • idOrProps
)
... Object

Defined in app.js:1146

Read the analog state of pin for the device idOrProps. v1.3.6 changing the order of the arguments, was: idOrProps,pin,callback.

Parameters:

  • pin ...String

    Describe...

  • callback ...String

    Optional callback(data) function is called passing the data of the Response

  • idOrProps ...Number

    Describe...

Returns:

... Object:

Returns this.

analogWrite

(
  • pin
  • value
  • idOrProps
)
... Object

Defined in app.js:1171

Write the PWM value to pin for the device `idOrProps. v1.3.6 changing the order of the arguments, was: idOrProps,pin,value.

Parameters:

  • pin ...String

    Describe...

  • value ...String

    value is in the range 0-255 (Uno) and 0-1023 (ESP8266).

  • idOrProps ...Number

    Describe...

Returns:

... Object:

Returns this.

app.getLibraries

() ... Object

Defined in app.js:2320

...

Returns:

... Object:

Returns an array of libraries that are required for this app

appendToVariable

(
  • variable
  • value
  • atFront
)
... Object

Defined in app.js:1196

Appends value to variable.

Parameters:

  • variable ... String Number

    Describe...

  • value ... String Number

    Describe...

  • atFront ... String Number

    Optionally if atFront is true adds the value to the front of the variable.

Returns:

... Object:

Returns this.

applyScrollRules

(
  • el
)
... Object

Defined in app.js:1225

Applies scroll rules to the current screen (based on classList). This must only happen once for each screen load.

Parameters:

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

autoConnectDevices

() ... Object

Defined in app.js:1317

Automatically connects to available devices. The first available device becomes the defaultDevice.

Returns:

... Object:

Returns this.

callFunction

(
  • deviceId
  • called_function
  • parameters
  • callback
)
... Object

Defined in app.js:1424

Calls the specified called_function on the devicedeviceId sending parameters and calling callback on the return.

Parameters:

  • deviceId ...Number

    [Optional] deviceId defaults to app._defaultDevice.

  • called_function ...String

    Describe...

  • parameters ...String

    Describe...

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

clearDevices

() ... Object

Defined in app.js:1447

Clears all Devices that have been connected.

Returns:

... Object:

Returns this.

clearInterval

(
  • identifierOrName
)
... Object

Defined in app.js:1462

Clears the interval identified by identifierOrName. If no identifierOrName then all Intervals are cleared.

Parameters:

  • identifierOrName ...Number

    Optional identifierOrName can be the identifier of the interval, or a name supplied by `app.setInterval().

Returns:

... Object:

Returns this.

deviceMotionHandler

(
  • eventData
)
... Object

Defined in app.js:1506

...

Parameters:

  • eventData ...String

    Describe...

Returns:

... Object:

Returns this.

devicesToString

() ... Object

Defined in app.js:1524

Returns a string represenation of all the connected devices. Default layout is: id - local_ip.

Returns:

... Object:

Returns this.

digitalRead

(
  • pin
  • callback
  • idOrProps
)
... Object

Defined in app.js:1544

Read the digital state of pin for the device idOrProps. Optional callback(data) function is called passing the data of the Response

Parameters:

  • pin ...String

    Describe...

  • callback ...String

    Optional callback(data) function is called passing the data of the Response.

  • idOrProps ...Number

    Describe...

Returns:

... Object:

Returns this.

digitalWrite

(
  • pin
  • value
  • idOrProps
)
... Object

Defined in app.js:1569

Write the digital value to pin for the device idOrProps. v1.3.6 changing the order of the arguments, was: idOrProps,pin,value .

Parameters:

  • pin ...String

    Describe...

  • value ...String

    Describe...

  • idOrProps ...Number
     

Returns:

... Object:

Returns this.

disableScroll

() ... Object

Defined in app.js:1594

...

Returns:

... Object:

Returns this.

doImports

() ... Object

Defined in app.js:1608

Import required libraries The libraries are listed in the App Description:. Add a line(s) starting with the keyword import followed by a list of libraries to import. Additional libraries can be on the same line (space or comma delimited) or on a new line with the import keyword.

Returns:

... Object:

Returns this.

Example:

import libdemo

doReady

() ... Object

Defined in app.js:1649

Calls all functions that have been set for app onReady

Returns:

... Object:

Returns this.

doScreenImports

(
  • id
  • el
)
... Object

Defined in app.js:1669

Import libraries referenced on the current screen

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

doScreenOnLoad

(
  • id
  • el
)
... Object

Defined in app.js:1707

Run any onLoad handlers for for the current screen

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

doThemes.

() ... Object

Defined in app.js:1734

Apply required themes. The themes are listed in the App Description:. Add a line(s) starting with the keyword theme followed by the theme name. Additional themes can be on the same line (space or comma delimited) or on a new line with the theme keyword.

Returns:

... Object:

Returns this.

Example:

theme urban

enableScroll

() ... Object

Defined in app.js:1763

...

Returns:

... Object:

Returns this.

findClass

(
  • element
  • className
)
... Object

Defined in app.js:1776

Returns the first DOM Element matching className.

Parameters:

  • element ...String

    Describe...

  • className ...String

    Describe...

Returns:

... Object:

Returns this.

findLocalDevices

(
  • Address
)
... Object

Defined in app.js:1792

Finds devices on the same LAN. The devices are "linked" to the app - stored in app._devices. If address is ommitted the app will try to determine it's own Local IP (must be online to do this) The first device found will be made the default device. iPhone Personal Hotspot Tethering IP range... 172.20.10.1-172.20.10.3 Android Hotspot IP 192.168.42.x

Parameters:

  • Address ...String

    Optional address is the local IP address of the app.

Returns:

... Object:

Returns this.

findParentItem

(
  • element
)
...

Defined in app.js:1876

Returns the Item containing the DOM element. If it finds an Item it returns the Item object.

Parameters:

  • element ...String

    This traverses up each parentElement.

Returns:

...:

Returns null.

function

(
  • number
  • duration
  • noBgChange
  • id
)
... Object

Defined in app.js:1373

Blinks the built-in LED. If no id passed in the default Device is used (IOIO is the initial default device).

Parameters:

  • number ...Number

    Describe...

  • duration ...String

    Describe...

  • noBgChange ...String

    Describe...

  • id ...Number

    Optional id to use a specific Device.

Returns:

... Object:

Returns this.

getData

(
  • idOrClassName
)
... Object

Defined in app.js:1913

The ClassName doesn't need to exist in the app... it can be a made-up 'table name', e.g. 'users'. If any screen has this ClassName, it will be linked to this 'table'. Multiple screens can use the same ClassName (even adding different fields to the same 'table'). If idOrClassName is. Null, and the current screen has ClassNames, check each ClassName for app data. If app data found, then return the first one found. Else return the screen data and save the classnames in app localstorage. A ClassName, then look for app data (not Screen data) matching ClassName. If app data found, return it. Else go through classnames in app locastorage.. If a match found, move the screendata to classname data and return. Else create an empty app data and return it. An Id (number),. Return the screen data.

Parameters:

  • idOrClassName ... String Number

    Describe...

Returns:

... Object:

Returns the Data object for `idOrClassName'.

getDevice

(
  • idOrProps
  • key
)
... Object

Defined in app.js:1979

Returns the device for idOrProps. If noidOrProps` passed in, the default device is returned.

Parameters:

  • idOrProps ...Number

    idOrProps Can be a deviceId (a ten character string). Or an object in the form. {id: xxx, [local_ip: xxx, layoutId: xxx]}

  • key ...String

    Optionl key is the aREST Pro key

Returns:

... Object:

Returns the device for idOrProps

getIdFromDOMId

(
  • domId
)
... Object

Defined in app.js:2032

...

Parameters:

  • domId ...Number

    Describe...

Returns:

... Object:

Returns this.

getIPs

(
  • callback
)
... Object

Defined in app.js:2045

Looks for the Local IP address(es) for the app. Adds all the IP Addresses to app._appIPAddresses[].

Parameters:

  • callback ...String

    Calls callback(ip_addr) for each IP Address.

Returns:

... Object:

Returns this.

getItem

(
  • idOrClassName
  • element
)
... Object

Defined in app.js:2146

Returns an Item object for idOrClassName. IdOrClassName can be the ItemId or the ClassName set in Custom Classes, or the DOM id of the item.

Parameters:

  • idOrClassName ...Number

    idOrClassNamecan be theItemIdor theClassNameset inCustom Classes`, or the DOM id of the item.

  • element ...String

    Optional element is assinged to the Item.element property.

Returns:

... Object:

Returns an Item object for idOrClassName.

getItemByClassName

(
  • name
)
... Object

Defined in app.js:2254

...

Parameters:

  • name ...String

    Describe...

Returns:

... Object:

Returns an Item matching name

getItemByDomId

(
  • domId
  • element
)
... Object

Defined in app.js:2273

...

Parameters:

  • domId ...Number

    Describe...

  • element ...String

    Optional element is the DOM Element

Returns:

... Object:

Returns an Item object for domId which is the id of the Element in the DOM Tree

getItemHTML

(
  • id
  • type
  • data
)
... Object

Defined in app.js:2211

...

Parameters:

  • id ...Number

    Describe...

  • type ... String Number

    Describe...

  • data ... String

    Describe...

Returns:

... Object:

Returns this.

getItemsElement

(
  • Name...
)
... Object

Defined in app.js:2291

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns this.

Example:

paste example here

getJSON

(
  • appIdOrSlug
)
... Object

Defined in app.js:2305

...

Parameters:

  • appIdOrSlug ... String Number

    Describe...

Returns:

... Object:

returns a JSON object .

getLocalIP

(
  • callback
)
... Object

Defined in app.js:2348

Searches for the Local IP Address for the app

Parameters:

  • callback ...String

    IP addresses starting with 10. and 192. are treated as local callback(ip_addr) is called if a local IP is found. The app needs internet connectivity to do this.

Returns:

... Object:

Returns this.

Example:

paste example here

getLocalProperty

(
  • property
)
... Object

Defined in app.js:2375

...

Parameters:

  • property ...String

    Describe...

Returns:

... Object:

Returns the value for property from localStorage for the app

getLocalStorage

() ... Object

Defined in app.js:2391

The Key for app localstorage is app123 (where 123 is the ID of the app)

Returns:

... Object:

Returns the object stored in localStorage for this screen The following properties are stored AppId (integer) datasets (object) {ClassName: [{},{}...] } e.g. datasets.users = [{username: 'abc'},{username:'xyz'}]

getPinValue

(
  • pinNameOrNumber
  • id
)
... Object

Defined in app.js:2421

...

Parameters:

  • pinNameOrNumber ...String

    Describe...

  • id ...Number

    Optional id to use a specific Device If no id passed in the default Device is used (IOIO is the initial default device)

Returns:

... Object:

Returns the value for pin pinNameOrNumber.

Example:

paste example here

getRandomColor

(
  • numOfSteps
  • step
)
... Object

Defined in app.js:2457

...

Parameters:

  • numOfSteps ...String

    Optional numOfSteps determines how many steps to separate the color spectrum into.

  • step ...String

    Optional step specifies the specific step to return. Default is a random step.

Returns:

... Object:

Returns a random color in the format rgb(x,y,z).

getRemoteIP

(
  • callback
)
... Object

Defined in app.js:2499

Searches for the Remote IP Address for the app IP addresses starting with 10. and 192. are treated as local

Parameters:

  • callback ...String

    callback(ip_addr) is called if a remote IP is found.

Returns:

... Object:

Returns this.

getScreen

(
  • id
)
... Object

Defined in app.js:2522

...

Parameters:

  • id ...Number

    Describe...

Returns:

... Object:

returns the Screen object for id

getThemes

(
  • Name...
)
... Object

Defined in app.js:2588

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Return an array of themes for this app

getVariable_xxx

(
  • name
)
... Object

Defined in app.js:2617

...

Parameters:

  • name ... String Number

    [NOTE: the method name is getVariable without _xxx and it already exists in the built-in JavaScript library. It is included here for documentation purposes only.]

Returns:

... Object:

Returns this.

Example:

paste example here

handleError

(
  • er
  • msg
)
... Object

Defined in app.js:2636

Handles errors. Logs er and msg

Parameters:

  • er ...String

    Describe...

  • msg ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

paste example here

hideLoader

(
  • timeout
)
... Object

Defined in app.js:2655

Hides the loading element

Parameters:

  • timeout ... String Number

    Optional - Delay hiding until timeout

Returns:

... Object:

Returns this.

hideTabBar

() ... Object

Defined in app.js:2678

Hides the tab bar

Returns:

... Object:

Returns this.

idOrPropsToObject

(
  • idOrProps
)
... Object

Defined in app.js:2704

...

Parameters:

  • idOrProps ...Number

    Describe...

Returns:

... Object:

Returns an object using `idOrProps

import

(
  • idOrSlug
  • callback
)
... Object

Defined in app.js:2727

Imports the required JavaScript library

Parameters:

  • idOrSlug ... String Number

    The library is imported from the Custom JavaScript from another app idOrSlug.

  • callback ... String Number

    Optional callback called once imported.

Returns:

... Object:

Returns this.

Example:

Valid values for library include: * appcar, libphaser.

initAccordion

() ... Object

Defined in app.js:2800

Initialises any accordions on the screen To create an Accordion add the className accordion to the Item

Returns:

... Object:

Returns this.

loadAppData

(
  • idOrSlug
  • callback
)
... Object

Defined in app.js:2833

Loads the app data for another app idOrSlug

Parameters:

  • idOrSlug ...Number

    Optional callback function called, passed one parameter: idOrSlug

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

SPECIAL CASE

Change 'appcar' to 'libappcar' - temporary workaround to get appcar library from another app this allows the app 'appcar' to be the user facing app

loadScript

(
  • url
  • callback
)

Defined in app.js:2892

...

Parameters:

  • url ...String

    Describe...

  • callback ...String

    Describe...

log

(
  • aMsg
)
... Object

Defined in app.js:2936

Save aMsg to the app._log

Parameters:

  • aMsg ...String

    The user can access the log by clicking on the status light in the simulator

Returns:

... Object:

Returns this.

loop Add new functions to the loops by passing arguments to `loop` arg[0] - function reference or an ad-hoc function arg[1] - the interval for this function, e.g. 1000 will run it every second. arg [2...n] - arguments to the function arg[0]

() ... Object

Defined in app.js:2997

the loop function repeats continuously carrying out any user defined tasks

Returns:

... Object:

Returns this.

Example:

e.g. app.loop('app.setBackgroundColor',2000,'random') If there are arguments, add the new function to the loop

neoPixel

(
  • params
  • deviceId
  • callback
)
... Object

Defined in app.js:3075

Sends params to deviceId to do NeoPixel routines

Parameters:

  • params ...String

    params is an object in the format: { routine: [101...199], // the routine number s: [1...4], // Optional, the Strip number, default 1
    wait: int, // Optional, the number of milliseconds to wait between changes, default 20 duration: int, // Optional, duration of the routine, default to 0 - ongoing color: "hex"/{rgb} // Optional, color either hex string or rgb object }

  • deviceId ...Number

    Optional deviceId specifies the device, else _deafultDevice is used

  • callback ...String

    Optional callback is called on completion

Returns:

... Object:

Returns this.

onItemClicked

(
  • e
)
... Object

Defined in app.js:3135

Saves the _currentItemId when Element e is clicked.

Parameters:

  • e ... String

    Describe...

Returns:

... Object:

Returns this

onReady

(
  • fn
  • params
)
... Object

Defined in app.js:3162

This method can be called multiple times to add multiple functions to the ready event

Parameters:

  • fn ...String

    Will call function fn when the app is ready.

  • params ...String

    (optional) params is an array of parameters that will be passed to fn when calling/apply.

Returns:

... Object:

Returns this.

onTouchend

(
  • e
)
... Object

Defined in app.js:3234

Event handler for the touchend and mouseup events

Parameters:

  • e ...String

    Describe...

Returns:

... Object:

Returns this.

onTouchmove

(
  • e
)
... Object

Defined in app.js:3249

Event handler when touch or mouse moves

Parameters:

  • e ...String

    Describe...

Returns:

... Object:

Returns this.

onTouchstart

(
  • e
)
... Object

Defined in app.js:3316

Event handler for the touchstart and mousedown events

Parameters:

  • e ...String

    Need to make sure scroll rules have been applied, because on some mobiles the screen event doesn't fire.

Returns:

... Object:

Returns this.

preload

(
  • images
)
... Object

Defined in app.js:3340

Preloads the images passed in an array

Parameters:

  • images ... String

    Preloads the images passed in an array Format of images':[ 'url1','urls',...]`

Returns:

... Object:

Returns this.

prependToVariable

(
  • variable
  • value
)
... Object

Defined in app.js:3367

prepends value to variable and return the result

Parameters:

  • variable ...String

    Describe...

  • value ...String

    Describe...

Returns:

... Object:

Returns this.

reformatCaptureItems

(
  • id
  • el
)
... Object

Defined in app.js:3385

Reformat Items of type Capture to show the file input element This is a temporary fix because the AppShed UI did not update to support HTML5 capture items

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

reformatDataItems

(
  • id
  • el
)
... Object

Defined in app.js:3428

Reformat Items that have special functionality for Data

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

reformatInputTypes

(
  • id
  • el
)
... Object

Defined in app.js:3507

Reformat Items that have className range or 'slider' to show the range input element This is a temporaru fix because the AppShed UI did not update to support HTML5 range items

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

refreshScroll

() ... Object

Defined in app.js:3553

Refresh the iScroll

Returns:

... Object:

Returns this.

Example:

This is needed if items are added to the screen, as the size of the scroll area changes

removeClass

(
  • className
)
... Object

Defined in app.js:3575

Removes className from the app element

Parameters:

  • className ...String

    Describe...

Returns:

... Object:

Returns this.

removeScreenEvent_xxx

(
  • identifier
)

Defined in app.js:3594

Stops a Screen event from being called when a screen loads

Parameters:

  • identifier ...Number

    identifier is the return value of app.addScreenEvent()

removeTabEvent_xxx

(
  • identifier
)

Defined in app.js:3608

Stops a Tab event from being called when a screen loads

Parameters:

  • identifier ...Number

    identifier is the return value of app.addTabEvent()

removeVariableEvent_xxx

(
  • identifier
)

Defined in app.js:3621

...

Parameters:

  • identifier ...Number

    identifier is the return value of app.addVariableEvent()

replaceItemHTML

(
  • html
  • data
)
... Object

Defined in app.js:3636

Replace the values of the Item html using the properties supplied in data

Parameters:

  • html ...String

    Describe...

  • data ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

Supported Properties image: the URL of the image title text name value checked

repositionItems

(
  • id
  • el
)
... Object

Defined in app.js:3700

Reposition items based on className

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

Supported classNames: 

position-bottom

saveScreenData

(
  • id
  • el
)
... Object

Defined in app.js:3731

Save data about the screen to localStorage

Parameters:

  • id ...Number

    Describe...

  • el ...String

    Describe...

Returns:

... Object:

Returns this.

sendCommands

(
  • cmds
  • id
  • key
  • callback
)
... Object

Defined in app.js:3752

Sends commands cmds to a Device

Parameters:

  • cmds ...String

    cmds expect an array of command arrays, where each command array contains 4 items: [format,pin,value,duration]

  • id ...Number

    Optional id specifies the Device ID, otherwise _defaultDevice is used

  • key ...String

    Optional key specidies the Pro key

  • callback ...String

    Optional callback is called once the commands have been sent. callback may be called multiple times if the number of commands being sent exceeds Device.ioMaxCommandsPerBatch

Returns:

... Object:

Returns this.

Example:

Example: Turn digital Pin 4 on for 1 second
   [ [1,4,1,1000] , [1,4,0,0] ] 

setAction

(
  • idOrClassName
  • handler
)
... Object

Defined in app.js:3784

...

Parameters:

  • idOrClassName ...Number

    Removes all other Actions for this idOrClassName.

  • handler ...String

    Sets the action handler for idOrClassName.

Returns:

... Object:

Returns this.

setBackground

(
  • color
)
... Object

Defined in app.js:3804

Shortcut for app.setBackgroundColor

Parameters:

  • color ...String

    If no color uses random color.

Returns:

... Object:

Returns app.getBackgroundColor()

setBackgroundColor

(
  • color
)
... Object

Defined in app.js:3825

Set the BackgroundColor of the current screen to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setDefaultDevice

(
  • idOrProps
)
... Object

Defined in app.js:3853

Sets the default device for the app.

Parameters:

  • idOrProps ...Number

    idOrProps can pass in either the deviceId or a properties Object.

Returns:

... Object:

Returns this.

setInterval

(
  • func
  • delay
  • timeout
  • name
)
... Object

Defined in app.js:3874

...

Parameters:

  • func ...String

    repeatedly calls a function func with a fixed delay.

  • delay ...String

    Describe...

  • timeout ...String

    optionally stops after timeout

  • name ...String

    Optionally gives this interval a name which can be used by clearInterval.

Returns:

... Object:

Returns this.

setLocalProperty

(
  • property
  • value
)
... Object

Defined in app.js:3924

...

Parameters:

  • property ... String Number

    Saves the value for property in localStorage for the app.

  • value ... String Number

    Describe...

Returns:

... Object:

Returns bool true if successful.

setLocalStorage

(
  • obj
)
... Object

Defined in app.js:3944

Saves the obj to in localStorage for the app

Parameters:

  • obj ...String

    obj must have a valid format. Required: AppId (int) Required: data (Array)

Returns:

... Object:

Returns bool true if the process was successful

setMotorDriver

(
  • type
  • id
  • key
  • callback
)
... Object

Defined in app.js:3983

Sends commands cmds to a Device cmds expect an array of command arrays, where each command array contains 4 items: [format,pin,value,duration]

Parameters:

  • type ...String

    Describe...

  • id ...Number

    Optional id specifies the Device ID, otherwise _defaultDevice is used.

  • key ...String

    Optional key specidies the Pro key.

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

Example: Turn digital Pin 4 on for 1 second.
[ [1,4,1,1000] , [1,4,0,0] ]

setPin

(
  • pinNameOrNumber
  • val
  • id
  • key
)
... Object

Defined in app.js:4012

Sets the pin number pinNameOrNumber to val

Parameters:

  • pinNameOrNumber ... String Number

    If no id passed in the default Device is used (IOIO is the initial default device).

  • val ... String Number

    Describe...

  • id ... String Number

    Optional id to use a specific Device.

  • key ... String Number

    Describe...

Returns:

... Object:

Returns this.

setRGB

(
  • color
  • pins
  • id
  • key
)
... Object

Defined in app.js:4048

Sets the RGB LED to color (see Device.setRGB)

Parameters:

  • color ...String

    Describe...

  • pins ...String

    Describe...

  • id ...Number

    Optional id to use a specific Device. If no id passed in the default Device is used.

  • key ...String

    Describe...

Returns:

... Object:

Returns this.

setTabBarBackgroundColor

(
  • color
)
... Object

Defined in app.js:4073

...

Parameters:

  • color ...String

    Sets the backgroundColor of the TabBar to color.

Returns:

... Object:

Returns this.

setTabBarColor

(
  • color
)
... Object

Defined in app.js:4091

...

Parameters:

  • color ...String

    Sets the text color on the TabBar to color.

Returns:

... Object:

Returns this.

setTitleBackgroundColor

(
  • color
)
... Object

Defined in app.js:4110

Sets the backgroundColor of the Screen Title to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setTitleColor

(
  • color
)
... Object

Defined in app.js:4129

Sets the color of the Screen Title to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setVariable_xxx

(
  • name
  • value
)
... Object

Defined in app.js:4148

Set the value of the variable name to value.

Parameters:

  • name ...String

    [NOTE: the method name is setVariable without _xxx and it already exists in the built-in JavaScript library. It is included here for documentation purposes only.]

  • value ...String

    Describe...

Returns:

... Object:

Returns this.

showLoader

(
  • timeout
)
... Object

Defined in app.js:4165

Shows the loading element

Parameters:

  • timeout ... String Number

    Optional - Hide the loader after timeout.

Returns:

... Object:

Returns this.

showRemoteScreen_xxx

(
  • url
)
... Object

Defined in app.js:4188

The app will navigate to a remote screen that is loaded from url.

Parameters:

  • url ...String

    url can contain parameters in the form {name} that will be replaced with the value of a form variable with the given name.

Returns:

... Object:

Returns this.

Example:

For example url = https://mydomain.com/myscript.php?FirstName=[myName] [NOTE: the method name is showRemoteScreen without _xxx and it already exists in the built-in JavaScript library. It is included here for documentation purposes only.]

showScreen_xxx

(
  • id
)
... Object

Defined in app.js:4211

The app will navigate the screen with id

Parameters:

  • id ...Number

    NOTE: the method name is showScreen without _xxx and it already exists in the built-in JavaScript library. It is included here for documentation purposes only.]

Returns:

... Object:

Returns this.

showTab_xxx

(
  • id
)
... Object

Defined in app.js:4227

The app will navigate the tab with id

Parameters:

  • id ... String Number

    [NOTE: the method name is showTab without _xxx and it already exists in the built-in JavaScript library. It is included here for documentation purposes only.]

Returns:

... Object:

Returns this.

showTabBar

(
  • id
)
... Object

Defined in app.js:4244

Show the tab bar (if it is hidden)

Parameters:

  • id ...Number

    Describe...

Returns:

... Object:

Returns this.

togglePin

(
  • pinNameOrNumber
  • id
)
... Object

Defined in app.js:4284

Toggles the pin pinNameOrNumber

Parameters:

  • pinNameOrNumber ...String

    Optional id to use a specific Device If no id passed in the default Device is used (IOIO is the initial default device)

  • id ...Number

    Describe...

Returns:

... Object:

Returns this.

togglePinValue

(
  • pinNameOrNumber
  • id
)
... Object

Defined in app.js:4315

Override method for togglePin

Parameters:

  • pinNameOrNumber ...String

    Describe...

  • id ...Number

    Describe...

Returns:

... Object:

Returns this.

toRGB

(
  • color
)
... Object

Defined in app.js:4330

...

Parameters:

  • color ... String Number

    color must be a 6 character Hexadecimal.

Returns:

... Object:

Returns an object with r,g,b properties for the supplied color' Ifcolor` is already an rgb object, return it

toRGBInt

(
  • color
)
... Object

Defined in app.js:4369

...

Parameters:

  • color ...String

    color can be hex color or RGB object.

Returns:

... Object:

Returns the RGB integer value for color

Example:

paste example here

Properties

version

String

Defined in app.js:123

The version number of app.js

Default: "1.2.3"

  • Wednesday, 24 January 2018

appshed name white text 250

Copyright © 2017 AppShed Limited