Browsercontrol - dtex/NodebotUI GitHub Wiki

back

The BrowserControl class constructs an object that maps to an input or group of inputs. Each of these inputs maps to a device in Johnny-Five.

Browser Controls are represented in the HTML by a an <input> or <fieldset> element that has a unique ID attribute and a data-device-type attribute of one of our BrowserControl types. This example:

<form id="sampleBoard" data-device-type="board">
  <fieldset id="myOrientator" data-device-type="orientation">
    <input data-device-type="servo" id="myBeta" data-axis="beta" />
    <input data-device-type="servo" id="myGamma" data-axis="gamma" />
  </fieldset>
</form>

will initialize a board in the NodebotUI server, create an orientation BrowserControl and bind servos to the beta and gamma axes. When you tilt your device, the servos will move.

Parameters

Attribute Name Type Value(s) Description Required
id String Any string that starts with an alpha or _ A unique identifier. This value must not be used on any other element yes
data-device-type String Orientation Indicates type of BrowserControl yes

API

Lineage

Child of of Window.nodebotui

back

⚠️ **GitHub.com Fallback** ⚠️