Have any questions?

+44 (20) 3540 6226

hello@appshed.com

Classes

Classes available in app.js

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"

Data (Class)

AppShedData Class

Defined in: app.js:8163

Class definition for Data Object Defaults to the data on the current screen.

Constructor

AppShedData

(
  • idOrClassName
  • options
)

Defined in app.js:8163

 

Parameters:

  • idOrClassName ...Number

    Optional idOrClassName specifies which data to retrieve.

  • options ...String

    Optional options - an object. {isAppData: if true this is app data not screen data}.

Item Index

Methods

Methods

avg

(
  • variable
)
... Object

Defined in app.js:8192

Return the average of the values for variable

Parameters:

  • variable ...String

    If variable not passed in use the first column.

Returns:

... Object:

Returns null

clearData

() ... Object

Defined in app.js:8214

Clears the data

Returns:

... Object:

returns bool true if successful

count

(
  • variable
  • notEmpty
)
... Object

Defined in app.js:8230

...

Parameters:

  • variable ...String

    If variable not passed in use the first column.

  • notEmpty ...String

    Optional bool notEmpty specifies that only non-empty values should be counted.

Returns:

... Object:

Return the count of values for variable

Device (Class)

Device Class

Defined in: app.js:6357

You can create an object of this class for each device that the app connects to.

Constructor

Device

()

Defined in app.js:6357

 

Methods

addBatchCommand

(
  • format
  • pin
  • value
  • duration
)
... Object

Defined in app.js:6455

Add a command to the batch, and send after a timeout This allows multiple commands issued in close succession to be batched up, reducing dealys in multiple API calls

Parameters:

  • format ...String

    Describe...

  • pin ...String

    Describe...

  • value ...String

    Describe...

  • duration ...String

    Describe...

Returns:

... Object:

Returns this.

alertPinValue

(
  • pin
  • format
)
... Object

Defined in app.js:6486

Shows a screen alert message with the value of the pin.

Parameters:

  • pin ...String

    Describe...

  • format ...String

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

Returns:

... Object:

Returns this.

analogRead

(
  • pin
  • callback
)
... Object

Defined in app.js:6515

...

Parameters:

  • pin ...String

    Describe...

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

analogWrite

(
  • pin
  • state
  • noBatch
)

Defined in app.js:6537

Send an API call to the device to write an analog value to pin. Optionally If useBatchCommands is true the command is cached and sent after a short delay in a batch

Parameters:

  • pin ...String

    Describe...

  • state ...String

    Describe...

  • noBatch ...String

    Describe...

attachServos

(
  • attachArray
)
... Object

Defined in app.js:6566

Attach servos to pins

Parameters:

  • attachArray ...String

    attachArray is a two-dimensional array [x][2].

Returns:

... Object:

Returns this.

Example:

For each x, the array has the servo number (e.g. 1) and the pin number (e.g. 7)

callFunction

() ... Object

Defined in app.js:7400

...

Returns:

... Object:

Returns this.

callFunction

(
  • called_function
  • parameters
  • onSuccess
  • onFail
)
... Object

Defined in app.js:6641

Calls a function defined on the device

Parameters:

  • called_function ...String

    Describe...

  • parameters ...String

    Describe...

  • onSuccess ...String

    Describe...

  • onFail ...String

    Describe...

Returns:

... Object:

Returns this.

cancelPending

(
  • method
  • pin
  • state
)
... Object

Defined in app.js:6679

Cancels the method,pin,state combination from the pending methods.

Parameters:

  • method ...String

    Describe...

  • pin ...String

    Describe...

  • state ...String

    Describe...

Returns:

... Object:

Returns this.

configureAddress

() ... Object

Defined in app.js:6702

Configures which address to use for calls to this device. Priority for which address to use is given in the following order:

  • 192.168.4.1 for local deviceID when using softAP
  • localIP
  • localIPFromRemote
  • The default cloud webservice

Returns:

... Object:

Returns this.

configureLayout

() ... Object

Defined in app.js:6748

configures the board layout using the IoT Builder layout settings Using a layout makes it much simpler for novice users as they make use of the IoT Builder to configure the board. Using a layout is optional. The app can simply set pins using pin numbers directly.

Returns:

... Object:

Returns this.

connect

(
  • onConnect
  • onFail
)
... Object

Defined in app.js:6774

Connects to the device.

Parameters:

  • onConnect ...String

    Optional function onConnect called once connected.

  • onFail ...String

    Optionalfunction onFail called if connection fails.

Returns:

... Object:

Returns this.

digitalRead

(
  • pin
  • callback
)
... Object

Defined in app.js:6798

...

Parameters:

  • pin ...String

    Reads the digital value of pin.

  • callback ...String

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

Returns:

... Object:

Returns this.

digitalWrite

(
  • pin
  • state
  • noBatch
)
... Object

Defined in app.js:6823

...

Parameters:

  • pin ...String

    Sets the digital output on pin to `state.

  • state ...String

    state must be either 1 or 0.

  • noBatch ...String

    Optionally If useBatchCommands is true the command is cached and sent after a short delay in a batch.

Returns:

... Object:

Returns this.

fade

(
  • pin
  • direction
  • duration
  • noBgChange
)
... Object

Defined in app.js:6866

Fade pin on or off, depending on direction.

Parameters:

  • pin ...String

    Optional pin is the pin number (Default: 5, except on RaspberryPi: 7).

  • direction ...String

    If direction is "on" or 1, the pin will fade from 0 to 100% . If direction is "out", "off" or 0, the pin will fade from 100% to 0. Default direction is 1

  • duration ...String

    Optional duration determines how long the fade should take (Default: 5 seconds).

  • noBgChange ...String

    Optional noBgChange ensures that the Screen BackgroundColor is not changed during blink.

Returns:

... Object:

Returns this.

getInfo

(
  • data
)
... Object

Defined in app.js:7724

...

Parameters:

  • data ...String

    Describe...

Returns:

... Object:

Returns this.

getInfo

(
  • onSuccess
  • address
  • onFail
)
... Object

Defined in app.js:6913

Queries the device to get basic info

Parameters:

  • onSuccess ...String

    onSuccess is the function run when the data is returned from the device (arguments: data, textStatus, jqXHR).

  • address ...String

    Optional address can be passed in, the default address is this.address.

  • onFail ...String

    Optional onFail is the function called when the connection fails (arguments: a, textStatus, b).

Returns:

... Object:

Returns this.

getLayout

(
  • callback
)
... Object

Defined in app.js:6965

...

Parameters:

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

getLEDPin

() ... Object

Defined in app.js:6991

...

Returns:

... Object:

Returns the pinNumber for the built-in LED for this device.

getLocalIPFromRemote

()

Defined in app.js:7020

Try to get the LocalIP from the Remote address;

getPin

(
  • pinNameOrNumber
)
... Object

Defined in app.js:7043

Redundant function

Parameters:

  • pinNameOrNumber ...String

    Describe...

Returns:

... Object:

Returns this.getPinValue()

getPinFormat

(
  • pinNumber
)
... Object

Defined in app.js:7059

...

Parameters:

  • pinNumber ...String

    Describe...

Returns:

... Object:

Returns this.

getPinMode

(
  • pinNumber
)
... Object

Defined in app.js:7072

...

Parameters:

  • pinNumber ...String

    Describe...

Returns:

... Object:

Returns this.

getPinValue

(
  • pinNameOrNumber
)
... Object

Defined in app.js:7085

Returns the value of pin pinNameOrNumber

Parameters:

  • pinNameOrNumber ...String

    If a name is passed in, then this device must have a layout with a pin named accordingly. If polling has not started, this function starts polling the pin values.

Returns:

... Object:

Returns this.

getVariable

(
  • variable
  • callback
)

Defined in app.js:7141

...

Parameters:

  • variable ...String

    Describe...

  • callback ...String

    Describe...

init

() ... Object

Defined in app.js:6418

Initialize the object

Returns:

... Object:

Returns this.

isPending

(
  • method
  • pin
  • state
)
... Object

Defined in app.js:7159

...

Parameters:

  • method ...String

    Describe...

  • pin ...String

    Describe...

  • state ...String

    Describe...

Returns:

... Object:

Returns true if the method,pin,state combination is pending.

motionDriving

(
  • state
  • settings
)
... Object

Defined in app.js:7179

Drive the car using motion control (accelerometer)

Parameters:

  • state ...String

    (Optional) State indicates if you are turning Motion Driving on (1) or off (0), Default: 1.

  • settings ...String

    (Optional) Settings passes an object of settings.

Returns:

... Object:

Returns this.

motionDrivingLoop

()

Defined in app.js:7207

run the motion driving process and keep looping calibrate PWM run logo command

motionDrivingSettings

()

Defined in app.js:7231

Adjusts the settings for motion driving based on the current device accelration properties

poll

() ... Object

Defined in app.js:7286

Starts the polling for this device. Repeatedly updates the pin values for tied pins

Returns:

... Object:

Returns this.

pollRepeat

() ... Object

Defined in app.js:7307

Runs on a loop, Reads pin values and updates tied variables

Returns:

... Object:

Returns null

readPins

(
  • onSuccess
  • onFail
)
... Object

Defined in app.js:7328

Reads all the pins and updates the device info

Parameters:

  • onSuccess ...String

    Optional onSuccess called once the info has been updated.

  • onFail ...String

    Optional onFail called if the info can't be updated.

Returns:

... Object:

Returns this.

sendCommands

(
  • cmds
  • callback
)

Defined in app.js:7363

Sends the next batch of commands

Parameters:

  • cmds ...String

    Optional cmds arary holds the commands to send, otherwise uses this.ioBatchCommands. cmds expect an array of command arrays, where each command array contains 4 items: [format,pin,value,duration].

  • callback ...String

    Optional callback is the callback function - this might be called multiple times if the commands are sent in multiple batches.

setLayout

(
  • data
)
... Object

Defined in app.js:7420

sets the layout to data (expecting a JSON object)

Parameters:

  • data ...String

    Describe...

Returns:

... Object:

Returns this.

setLED

(
  • val
)
... Object

Defined in app.js:7437

Sets the built-in LED to val

Parameters:

  • val ...String

    val can be 1/0 or ON/OFF or true/false. NB: Setting the LED "ON" in some cases pulls the Pin down (i.e. "OFF")!.

Returns:

... Object:

Returns this.

setMotorDriver

(
  • type
  • callback
)
... Object

Defined in app.js:7473

Sets the Motor Driver to type;

Parameters:

  • type ...String

    Describe...

  • callback ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

Options are: 
   0 (default) Motor Shield 1 L298N 2 L9110

setPending

(
  • method
  • pin
  • state
)
... Object

Defined in app.js:7500

Sets a flag to indicate that a method,pin,state combination is pending (i.e. the AJAX request is running) This is used to stop duplicate requests being sent continuously thereby overloading the device

Parameters:

  • method ...String

    method must be one of:.

    • analogRead
    • analogWrite
    • digitalRead
    • digitalWrite
  • pin ...String

    Create a key using pin_state.

  • state ...String

    Describe...

Returns:

... Object:

Returns this.

setPin

(
  • pinNameOrNumber
  • val
)
... Object

Defined in app.js:7533

Sets the pin number pinNameOrNumber to val

Parameters:

  • pinNameOrNumber ...String

    Presume a pin number passed in.

  • val ...String

    Describe...

Returns:

... Object:

Returns this.

setPinFormat

(
  • pinNumber
  • format
)
... Object

Defined in app.js:7599

...

Parameters:

  • pinNumber ...String

    Sets the format of pinNumber to format.

  • format ...String

    format must be either d for digital or a for analog.

Returns:

... Object:

Returns this.

setPinMode

(
  • pin
  • state
)
... Object

Defined in app.js:7617

...

Parameters:

  • pin ...String

    Set the mode of pin to state.

  • state ...String

    state must be either i for input or o for output.

Returns:

... Object:

Returns this.

setRGB

(
  • color
  • pins
)
... Object

Defined in app.js:7655

Sets an RGB LED to color

Parameters:

  • color ...String

    color can be a HEX color or an object with properties r,g,b specifying a value 0-255.

  • pins ...String

    Optional pins specifies the pins to use, default is 5,6,7 for r,g,b. pins is an object with properties r,g,b specifying the pin numbers.

Returns:

... Object:

Returns this.

testLocalIP

(
  • fromRemote
)
... Object

Defined in app.js:7688

Tests this.local_ip to determine if the app can use it instead of the Remote address

Parameters:

  • fromRemote ...String

    Optional: If fromRemote is true it will test this.local_ipFromRemote.

Returns:

... Object:

Returns this.

tie

(
  • pinNameOrNumber
  • variable
)
... Object

Defined in app.js:7752

...

Parameters:

  • pinNameOrNumber ...String

    Ties the pin pinNameOrNumber to a variable. presume a pin number passed in.

  • variable ...String

    The variable is updated every time the pin is polled.

Returns:

... Object:

Returns this.

tieAllPinsToVariables

() ... Object

Defined in app.js:7823

Ties all input pins to variables by the same name Requires a layout to be specified for the device (to determine which pins are inputs) Allows for easy moniotring of pins: simply create form fields (variables) with the same names as the pins Also allows you to name variables using the pinNumber, but with multiple connected devices using pinNumber will cause conflicts.

Returns:

... Object:

Returns this.

togglePin

(
  • pinNameOrNumber
)
... Object

Defined in app.js:7858

...

Parameters:

  • pinNameOrNumber ...String

    Describe...

Returns:

... Object:

Returns null

toString.

()

Defined in app.js:7880

...

updatedTiedVariables

(
  • pinNumber
)
... Object

Defined in app.js:8012

Update all variables tied to pins with the latest pin value

Parameters:

  • pinNumber ...String

    Describe...

Returns:

... Object:

Returns this.

updateInfo

(
  • data
)
... Object

Defined in app.js:7897

Update the basic Info of the device using data

Parameters:

  • data ...String

    Describe...

Returns:

... Object:

Returns this.

updateProperties

(
  • props
)
... Object

Defined in app.js:7948

...

Parameters:

  • props ...String

    Describe...

Returns:

... Object:

Returns this.

updateRemoteAddress

() ... Object

Defined in app.js:7996

...

Returns:

... Object:

Returns this.

Item (Class)

Item Class

Defined in: app.js:4424

An object of this class is created for each item on the screen.

Constructor

Item

()

Defined in app.js:4424

 

Methods

addAction

(
  • handler
)
... Object

Defined in app.js:4495

Add an Action for this Item

Parameters:

  • handler ...String

    handler is a function name or adhoc function. Items can contain multiple actions. The AppBuilder defines only the default action.

Returns:

... Object:

Returns this.

addBefore

() ... Object

Defined in app.js:4516

...

Returns:

... Object:

Returns this.

callActions

(
  • Name...
)
... Object

Defined in app.js:4526

calls all actions for this Item

Parameters:

  • Name... ... String Number

    Describe... The default Action is set in AppBuilder. Additional Actions can be set using app.addAction(). Actions can be identified using the itemId, DOM id, and all Classnames.

Returns:

... Object:

Returns this.

callEachAction

(
  • arr
)
... Object

Defined in app.js:4570

Loops through arr and calls the action for each element

Parameters:

  • arr ...String

    Describe...

Returns:

... Object:

Returns this.

containsClass

(
  • className
)
... Object

Defined in app.js:4587

...

Parameters:

  • className ...String

    Describe...

Returns:

... Object:

Returns true if this Item contains the custom class className

getBackgroundColor

() ... Object

Defined in app.js:4603

...

Returns:

... Object:

Returns the backgroundColor of this Item.

getDefaultValue

() ... Object

Defined in app.js:4618

...

Returns:

... Object:

Return the Default Value for this item.

getIconAbove

() ... Object

Defined in app.js:4640

...

Returns:

... Object:

returns the icon in the row above this icon

getIconBelow

() ... Object

Defined in app.js:4654

...

Returns:

... Object:

returns the icon in the row above this icon

getIconLeft

() ... Object

Defined in app.js:4667

...

Returns:

... Object:

returns the icon on the left of this icon

getIconRight

() ... Object

Defined in app.js:4680

...

Returns:

... Object:

returns the icon on the right of this icon

getImage

() ... Object

Defined in app.js:4693

...

Returns:

... Object:

returns the URL of the image for this item

getPosition This is only relevant when the item has been placed using `this.place()`;

() ... Object

Defined in app.js:4706

...

Returns:

... Object:

Returns an object with the x,y coordinates of the item

getSubTitle

(
  • str
)
... Object

Defined in app.js:4725

...

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns the Subtitle of the item

getText

(
  • str
)
... Object

Defined in app.js:4746

...

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns the Text of the item

getTitle

(
  • str
)
... Object

Defined in app.js:4771

...

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns the Title of the item

getVariable

() ... Object

Defined in app.js:4790

...

Returns:

... Object:

Returns app.getVariable() if this Item is a Form Item

getVariableName

() ... Object

Defined in app.js:4808

...

Returns:

... Object:

Returns the variable name if this is a Form Item

hide

() ... Object

Defined in app.js:4834

Hide this Item

Returns:

... Object:

Returns this

init

(
  • element
)
... Object

Defined in app.js:4480

...

Parameters:

  • element ...String

    Describe...

Returns:

... Object:

Returns this.

isAbove

(
  • otherId
)
... Object

Defined in app.js:4872

...

Parameters:

  • otherId ...Number

    Describe...

Returns:

... Object:

returns true this item is above the other Item

isBelow

(
  • otherId
)
... Object

Defined in app.js:4890

...

Parameters:

  • otherId ...Number

    Describe...

Returns:

... Object:

returns true this item is below the other Item

isFormItem

(
  • Name...
)
... Object

Defined in app.js:4851

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns true if this is a Form Item

isLeft

(
  • otherId
)
... Object

Defined in app.js:4908

...

Parameters:

  • otherId ...Number

    Describe...

Returns:

... Object:

returns true this item is left of the other Item

isRight

(
  • otherId
)
... Object

Defined in app.js:4926

...

Parameters:

  • otherId ...Number

    Describe...

Returns:

... Object:

returns true this item is right of the other Item

place

(
  • x
  • y
)
... Object

Defined in app.js:4944

place the item at a certain absolute x,y position

Parameters:

  • x ...String

    Describe...

  • y ...String

    Describe...

Returns:

... Object:

Returns this.

setAction

(
  • handler
)
... Object

Defined in app.js:4971

Sets the Action for this Item

Parameters:

  • handler ... String Number

    handler is a function name or adhoc function.

Returns:

... Object:

Returns this.

setBackgroundColor

(
  • color
)
... Object

Defined in app.js:4990

set the background color of this Item to color

Parameters:

  • color ...String

    Special case: color is 'random' will get a random color.

Returns:

... Object:

Returns this.

setBackgroundImage

(
  • src
  • method
)
... Object

Defined in app.js:5010

Sets the backgroundImage of this Item to src.

Parameters:

  • src ...String

    Describe...

  • method ...String

    Optional method determines the layout. One of: fit | fill | stretch | center | tile method defaults to fit

Returns:

... Object:

Returns this.

setHTML

(
  • str
)
... Object

Defined in app.js:5054

set the value of Html to str

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns this.

setImage

(
  • src
)
... Object

Defined in app.js:5071

set the image URL to src

Parameters:

  • src ...String

    Describe...

Returns:

... Object:

Returns this.

setLabel

(
  • str
)
... Object

Defined in app.js:5091

set the value of Label to str

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns this.

setLabelColor

(
  • color
)
... Object

Defined in app.js:5107

set the color of Label to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setSubTitle

(
  • str
)
... Object

Defined in app.js:5126

set the value of Sub Title to str

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns this.

setSubTitleColor

(
  • color
)
... Object

Defined in app.js:5141

set the color of SubTitle to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setText

(
  • str
)
... Object

Defined in app.js:5161

set the value of Text to str

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns this.

setTextColor

(
  • color
)
... Object

Defined in app.js:5187

set the color of Text to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setTitle

(
  • str
)
... Object

Defined in app.js:5212

set the value of Title to str

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns this.

Example:

paste example here

setTitleColor

(
  • color
)
... Object

Defined in app.js:5233

set the color of Title to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

show

() ... Object

Defined in app.js:5254

Show this Item

Returns:

... Object:

Returns this.

swap

(
  • otherId
)
... Object

Defined in app.js:5273

swaps this icon with the other

Parameters:

  • otherId ...Number

    Describe...

Returns:

... Object:

Returns this.

toString

(
  • Name...
)
... Object

Defined in app.js:5301

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

returns a string representation of the object

Properties

id

Int

Defined in app.js:4438

The id of the Item

Screen (Class)

Screen Class

Defined in: app.js:5372

An object of this class is created for each screen in the app.

Constructor

Screen

()

Defined in app.js:5372

 

Methods

addIconRow

(
  • rowHTML
  • index
  • data
)
... Object

Defined in app.js:5405

Adds a row of Icons by inserting rowHTML into the table

Parameters:

  • rowHTML ...String

    If rowHTML is ommitted then the HTML is generated using data.

  • index ...String

    index specifies the row where to insert. Defaults to -1 (bottom of the table).

  • data ...String

    data contains the values to be used for the Icons.

Returns:

... Object:

Returns this.

addIconRows

(
  • numRows
  • data
)
... Object

Defined in app.js:5438

adds numRows rows of icons

Parameters:

  • numRows ...String

    Describe...

  • data ...String

    Uses data to populate the rows.

Returns:

... Object:

Returns this.

clearItemsCache

() ... Object

Defined in app.js:5597

...

Returns:

... Object:

Returns this.

clearItemsCache

() ... Object

Defined in app.js:5629

Clears the items hash (local cache)

Returns:

... Object:

Returns this.

countColumns

() ... Object

Defined in app.js:5651

...

Returns:

... Object:

Returns the number of columns (for Icon screen types)

disableScroll

() ... Object

Defined in app.js:5667

Disables the defult scrolling of the screen. All the content is at fixed position, and content below the fold remains hidden.

Returns:

... Object:

Returns this.

enableScroll

() ... Object

Defined in app.js:5691

Enables the defult scrolling of the screen.

Returns:

... Object:

Returns this

getBackgroundColor

() ... Object

Defined in app.js:5707

...

Returns:

... Object:

Returns the backgroundColor of this Screen

getData

(
  • Name...
)
... Object

Defined in app.js:5725

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns the Data object for this screen

getIconAbove

(
  • iconId
)
... Object

Defined in app.js:5744

...

Parameters:

  • iconId ...Number

    Describe...

Returns:

... Object:

returns the icon in the row above this icon

getIconBelow

(
  • iconId
)
... Object

Defined in app.js:5772

...

Parameters:

  • iconId ...Number

    Describe...

Returns:

... Object:

returns the icon in the row below this icon

getIconLeft

(
  • iconId
)
... Object

Defined in app.js:5801

...

Parameters:

  • iconId ...Number

    Describe...

Returns:

... Object:

returns the icon on the left of this icon

getIconRight

(
  • iconId
)
... Object

Defined in app.js:5828

...

Parameters:

  • iconId ...Number

    Describe...

Returns:

... Object:

returns the icon on the left of this icon

getIconRowHTML

(
  • idStart
  • cols
  • data
)
... Object

Defined in app.js:5857

...

Parameters:

  • idStart ...Number

    Describe...

  • cols ...String

    Describe...

  • data ...String

    Describe...

Returns:

... Object:

returns the HTML for a row of (cols) Icons

getIcons

(
  • Name...
)
... Object

Defined in app.js:5888

The object has rows and columns corresponding to the icons on the screen

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns an object of items. Returns null if not an Icons screen

getItems

(
  • clearCache
)
... Object

Defined in app.js:5933

...

Parameters:

  • clearCache ... String Number

    Describe...

Returns:

... Object:

return all the items on this screen as objects.

getLocalProperty

(
  • property
)
... Object

Defined in app.js:5969

...

Parameters:

  • property ...String

    Describe...

Returns:

... Object:

Returns the value for property from localStorage for this screen

getLocalStorage

(
  • Name...
)
... Object

Defined in app.js:5985

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns the object stored in localStorage for this screen.

getNextId

(
  • testId
)
... Object

Defined in app.js:6006

...

Parameters:

  • testId ...Number

    The first ID for a screen is the Screen.id + 1.

Returns:

... Object:

Returns the next valid (unused) id. Used when creating Items dynamically.

getTable

() ... Object

Defined in app.js:6047

...

Returns:

... Object:

Returns this.

getTitle

(
  • str
)
... Object

Defined in app.js:6062

...

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns the Title of the screen

getType

(
  • Name...
)
... Object

Defined in app.js:6078

...

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns the type of Screen (list,icon,gallery,map)

setBackgroundColor

(
  • color
)
... Object

Defined in app.js:6106

Sets the backgroundColor of this Screen to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setBackgroundImage

(
  • src
  • method
)
... Object

Defined in app.js:6131

Sets the backgroundImage of this Screen to src.

Parameters:

  • src ...String

    Special case: if src is omitted, sets the background to the original background image.

  • method ...String

    Optional method determines the layout. One of: fit | fill | stretch | center | tile. method defaults to fit

Returns:

... Object:

Returns this.

setLocalProperty

(
  • Name...
)
... Object

Defined in app.js:6184

Saves the value for property in localStorage for this screen

Parameters:

  • Name... ... String Number

    Describe...

Returns:

... Object:

Returns bool true if successful

setLocalStorage

(
  • obj
)
... Object

Defined in app.js:6203

Saves the obj to in localStorage for this screen

Parameters:

  • obj ... String Number

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

Returns:

... Object:

Returns bool true if the process was successful

setTitle

(
  • str
)
... Object

Defined in app.js:6242

Sets the Title of the screen to str.

Parameters:

  • str ...String

    Describe...

Returns:

... Object:

Returns the Screen object

setTitleBackgroundColor

(
  • color
)
... Object

Defined in app.js:6260

Sets the backgroundColor of this Screen Title to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

setTitleColor

(
  • color
)
... Object

Defined in app.js:6281

Sets the backgroundColor of this Screen Title to color

Parameters:

  • color ...String

    Describe...

Returns:

... Object:

Returns this.

toString

() ... Object

Defined in app.js:6300

...

Returns:

... Object:

Returns a string represenation of the Screen

stats (Class)

stats Class

Defined in: app.js:9165

Class definition for the stats Object This is automatically created when the app loads You should not instantiate this object manually.

Constructor

stats

()

Defined in app.js:9165

 

Item Index

Methods

Methods

closeToolbox

(
  • `array`
)
... Number

Defined in app.js:9179

Returns the max value in array

Parameters:

  • `array` ... Array

    is an Array of Numbers

Returns:

... Number:

ui (Class)

ui Class

Defined in: app.js:9040

Class definition for the app.ui Object The UI class contains various methods for changing the user interface. This is automatically created when the app loads You should not instantiate this object manually.

Constructor

ui

()

Defined in app.js:9040

 

Item Index

Methods

Methods

closeToolbox

()

Defined in app.js:9054

Closes the toolbox

Returns:

 

appshed name white text 250

Copyright © 2017 AppShed Limited