Glossary
absolute coordinates (in Piu)
The coordinates of a content object
on the screen, expressed as distance from the edges of the screen. See also relative coordinates.
access point
In this book, the point of connection between your Wi-Fi network and the internet; also called a base station (or router)
. The access point creates a local network that allows devices connected to it to communicate directly, without using the internet.
alpha channel
An indication of the degree
of transparency (or opacity) of a solid color or pixels in a color image: which pixels should be drawn, which should be skipped, and which should be blended with the background.
anchor (in Piu)
A reference to a content object
saved as a property in the instantiating data of the content object.
ArrayBuffer
In JavaScript, a block of memory of a fixed number of bytes, with no type associated with the data in it. The memory is initialized to 0. To access the data, you wrap the ArrayBuffer
in a view; see also data view and typed array.
arrow function
In modern JavaScript, a compact syntax for declaring functions (using => syntax) that, when called, has a this value that’s the same as the this value of the function in which the arrow function
is defined; formally known as a lambda function
.
asynchronous networking
See non-blocking networking
.
bare module specifier
In JavaScript, a module specifier
that’s not a path. This book uses only bare module specifiers, which are more common for embedded JavaScript.
base station
See access point
.
behavior (in Piu)
A collection of methods that define the actions to be taken by a content object in response to events; specifically, an instance of a subclass of the Behavior class
that’s assigned to the content object.
BLE (Bluetooth Low Energy)
A wireless communication protocol
that features low power consumption and is widely used between two devices in close proximity to each other.
block (in flash memory)
An organizational unit for flash memory
. The size of a block varies depending on the flash memory component used; a common value is 4,096 bytes.
blocking networking
Networking in which the device will be unresponsive to user input during the network operation unless a more complex and memory-intensive technique, such as threads, is also used.
BMFont
A font format that combines a bitmap image with a map file. There are several variations of BMFont; the Moddable SDK uses the binary BMFont format.
bubble an event (in Piu)
To trigger a specified event on a content object, its parent container, and all container objects upward in the containment hierarchy, using the object’s bubble method
.
Central (in GAP)
One of the two main roles
defined by GAP. A Central scans for devices acting as Peripherals and initiates requests to establish a new connection with a Peripheral.
characteristic (in GATT)
In the GATT hierarchy
that defines the format of data, a value of a GATT service. See also profile and service.
child object, child (in Piu)
In a containment hierarchy, a content object that has been added to a container, which is said to be its parent object. The full term is often shortened to child.
chunked transfer encoding
A feature of the HTTP protocol that’s often used to deliver large responses. The HTTP Request class
decodes the chunks before invoking the callback function
, so your callback function doesn’t need to parse the chunk headers.
claiming (in mDNS)
The process whereby a device checks to see whether the mDNS name you chose for it is already in use because mDNS requires each device to have a unique name.
Client (in GATT)
See GATT Client
.
clipping
Restricting drawing to subsections of the display. It’s used by Poco to implement scanline rendering and by Piu to implement partial frame updates, and is also available for use in your applications—for example, to draw a subset of an image. See also clipping area
.
clipping area
The area that restricts where drawing will occur in the update area; a single rectangle in Poco, but possibly multiple rectangles in Piu. Only the portion of each drawing
operation that intersects the clipping area is drawn.
closure
In JavaScript, the binding of a function with a group of variables outside the function. The references to outside variables persist for the lifetime of the closure
.
Commodetto
A graphics library
that includes Poco and adds features such as offscreen graphics buffers, bitmaps, and instantiation of graphics assets from resources.
constructor
A special kind of function that, when invoked with new, creates an instance of the type specified by the constructor. The constructor function is executed to initialize the instance.
container (in Piu)
The organizing element of a containment hierarchy—a group into which content objects are placed within the hierarchy; specifically, an instance of any class that inherits from the Container class
, which inherits from the Content class and extends it with the ability to hold other content objects.
containment hierarchy (in Piu)
The tree of content objects, with the application object at the root, that make up the user interface of a Piu application.
content object (in Piu)
A JavaScript object that’s associated with a graphical element of the user interface; specifically, an instance of any class that inherits from the Content class
.
CSS (Cascading Style Sheets)
A language for defining styles
(for example, of text), most commonly used in web pages. Piu incorporates many CSS conventions to provide consistency for developers working on both web and IoT products.
data view
A view in which you
can wrap an ArrayBuffer to access the data in it. Unlike typed arrays, in which all the values are of the same type, data views are used to read and write different-sized integers and floating-point values in a buffer.
defer an event (in Piu)
To trigger a specified event on a content object at the next iteration of the event loop, using the object’s defer method
.
delegate an event (in Piu)
To immediately trigger a specified event on a content object, using the object’s delegate method
.
distribute an event (in Piu)
To trigger a specified event on a container and all content objects downward in the containment hierarchy, using the container’s distribute method
.
easing equations
Equations that implement common accelerations and decelerations for animated state changes; also known as
easing functions. These are often used to give animations a more natural feel by making something move more slowly at the start or near the end.
event (in Piu)
An occurrence, such as a tap on the screen, a change in a sensor value, or the expiration of a timer, that may trigger one or more content objects to take an action defined by the object’s behavior.
extended mode (for TMP102 sensor)
A mode that increases the resolution of the TMP102 from the default of 12 bits to 13 bits, enabling the measurement of temperatures up to 150°C.
from-tween (in Piu)
A tween, added to a timeline by the timeline’s from method
, that modifies the properties of the target object from the values specified in the properties object to the original values of the target object over duration milliseconds.
GAP (Generic Access Profile)
The BLE protocol layer
that defines how devices advertise themselves, how they establish connections with each other, and their connection security.
GATT (Generic Attribute Profile)
The BLE protocol layer
that defines the way BLE devices transfer data back and forth after a connection is established between them—a client-server relationship.
GATT Client
A BLE device that accesses
data from a remote GATT Server by sending read/write requests.
GATT Server
A BLE device that stores data locally
, receives read/write requests, and notifies the remote GATT Client of changes to the values of its characteristics.
high-level event (in Piu)
An event defined and triggered
by your application, using any name you like—for example, an onSensorValueChanged event to be triggered when the value of a sensor changes. See also low-level event.
host
A collection of JavaScript modules, configuration variables, and other software available that make up the environment in which your code runs. Each chapter in the repository for this book on GitHub has its own host, which contains the software environment needed to run that chapter’s examples.
host object
In XS, an object with a native destructor, which performs cleanup when an instance of the class is garbage-collected.
I
2C
A serial protocol for connecting multiple devices to a single two-wire bus.
I
2S
A protocol to connect digital audio devices; one of two hardware protocols supported by the AudioOut class
. It transmits unmodified audio samples over a digital connection from the microcontroller to a dedicated audio output component that performs the digital-to-analog conversion
. See also PDM.
immediate mode rendering
A rendering technique
, used in most graphics libraries used for microcontrollers, that performs the requested drawing operation when you call the drawing function. See also retained mode rendering.
immutable
A characteristic of JavaScript objects and values meaning they’re read-only—that is, you cannot modify them. JavaScript strings are immutable and so can’t be modified in place.
instantiating data (in Piu)
In a call to a content object constructor, a JavaScript value or object passed as the first argument and used to instantiate the class. This data is also passed to the onCreate method
of the created instance’s behavior.
iterator protocol
A protocol defined by JavaScript and implemented by the file module’s Iterator class
, which provides a standard way to implement and use iterators. For example, it enables the use of for-of loops
.
lambda function
See arrow function
.
lexical this
A feature of arrow functions whereby the value of this inside the arrow function is taken from the enclosing function.
low-level event (in Piu)
An event defined
and triggered by Piu—for example, the onTouchBegan event
when a finger is placed on a content object and onTouchEnded when the finger is removed. See also high-level event.
mDNS (Multicast DNS)
A protocol derived
from DNS
(Domain Name System) to allow devices to easily connect to each other on a local network. Whereas DNS is a centralized design that depends on authoritative servers to map names to IP addresses, mDNS is decentralized, with each individual device answering requests to map its name to an IP address.
MQTT (Message Queuing Telemetry Transport)
A publish-and-subscribe
networking protocol (designed for use by lightweight IoT client devices) that organizes message into topics.
non-blocking networking
A characteristic of networking APIs which means, for example, that when you request data from the network using the HTTP protocol, your code continues running while the request is made; also called
asynchronous networking. This is the way networking works when you use JavaScript on the web.
one-shot mode (for TMP102 sensor)
A mode for taking just one temperature reading from a TMP102 sensor. The most energy-efficient way to take infrequent readings, it’s available only when the device is in shutdown mode.
parent object, parent (in Piu)
In a containment hierarchy, a container into which a content object (said to be its child object) has been added. The full term is often shortened to parent.
partition (in flash memory)
An organizational unit for the flash memory
available to your microcontroller. For example, one partition contains your project’s code, another the preference data, and another the storage for the SPIFFS file system. Each partition is identified by a name.
PDM (pulse-density modulation)
The rapid toggling
of a digital output pin to create energy levels that correspond to the desired output signal; one of two hardware protocols supported by the AudioOut class. See also I
2S.
Peripheral (in GAP)
One of the two main roles defined by GAP. Peripherals
advertise themselves to Centrals and accept requests from Centrals to establish a connection.
Piu
In the Moddable SDK, an object-oriented user interface framework that simplifies the process of creating complex user interactions and uses Poco for drawing.
Poco
In the Moddable SDK, a rendering engine for embedded systems that you can use to draw to displays. See also Piu.
port (in Piu)
A content object that lets you issue drawing commands similar to Poco within a Piu layout; an instance of the Port class
.
private method
A method that can only be called from within a class’s implementation.
profile (in GATT)
In GATT, the top level of the hierarchy
that defines the format of data. A profile defines a specific use of BLE for communication between multiple devices, including the roles of the devices involved and their general behaviors. See also characteristic and service.
promise
A feature of modern JavaScript that provides an alternative to callbacks to simplify asynchronous programming. Callbacks can be turned into promises using small helper functions so that applications can use asynchronous functions.
property
A characteristic of a JavaScript object that’s similar to a field in C or C++, except that you can add properties to an object at runtime (without having to declare them in advance).
PWM (pulse-width modulation)
A type of digital signal
whereby the digital pin outputs a square wave with varied widths of high and low values. Taking the average of these high and low pulses over time creates a power level between the high and low values, proportional to the pulse widths.
relative coordinates (in Piu)
The coordinates of a content
object relative to the object’s parent container, expressed as margins from the edges of the container; the left, right, top, and bottom properties specify margins from the corresponding edge. See also absolute coordinates.
responsive layout (in Piu)
A layout rule that adjusts
intelligently to changes to the size of its parent container.
rest parameters
A feature of modern JavaScript that provides similar functionality to the special arguments variable, combining several arguments into an array, but is always available and is more flexible
.
retained mode rendering (in Poco)
A rendering technique
that doesn’t draw immediately but rather maintains a list of drawing commands that executes only when you tell Poco you’re done drawing
. See also immediate mode rendering.routerSee access point.
RSSI (received signal strength indication)
A measure of the strength
of the signal received from the Wi-Fi access point.
scanline rendering (in Poco)
A rendering technique that divides a frame into horizontal strips as small as a single row of pixels and, after each strip is rendered, immediately transmits it to the display.
Server (in GATT)
See GATT Server.
service (in GATT)
In the GATT hierarchy that defines the format of data, a collection of characteristics
that describe the behavior of part of a BLE device. See also characteristic and profile.
shutdown mode (for TMP102 sensor)
A mode that completely disables the temperature conversion hardware in a TMP102 sensor, reducing energy consumption to 0.5 μA. Your application can put the TMP102 in shutdown mode
in the interval between readings.
skin (in Piu)
An object that controls the drawing of the background of one or more content objects, filling the area with color or images. An instance of the Skin class
, it’s specified in a content object’s skin property. See also texture.
sloppy mode
A JavaScript mode primarily used for backward compatibility for websites. Sloppy mode
includes features that may be error prone or reduce performance. See also strict mode.
SMBus (System Management Bus)
A subset of I2C for register-based devices.
SNTP (Simple Network Time Protocol)
A lightweight
way for an IoT device to retrieve the current time from the network.
source rectangle (in Poco)
When drawing a bitmap, the area of the bitmap to use, enabling you to specify that only part of a mask or image should be drawn.
sparse array
A JavaScript array in which not all elements have an assigned value.
spread syntax
A feature of modern JavaScript that separates the elements of an array or properties of an object into individual arguments.
SSID (service set identifier)
The human-readable name of a Wi-Fi network provided by a Wi-Fi base station
.
strict equality operator
The JavaScript operator ===, which can be used in place of == to avoid type conversion. This operator never performs type conversion; if its operands are of different types, they’re always unequal.
strict inequality operator
The JavaScript operator !==, which can be used in place of != to avoid type conversion. This operator never performs type conversion; if its operands are of different types, they’re always unequal.
strict mode
A mode introduced in JavaScript 5th Edition which eliminates a handful of confusing and inefficient features. This book uses strict mode
exclusively. See also sloppy mode.
style (in Piu)
An object that controls the appearance of text, including the text’s font and color, in one or more content objects. An instance of the Style class
, it’s specified in a content object’s style property.
tag
A JavaScript feature that enables a function to modify the default behavior of template literals. For example, you can use this feature to convert the string representation of a UUID to binary data.
template (in Piu)
A class, created using a content object’s template method
, that enables you to eliminate redundancy when creating several similar objects.
template literal
A way of delineating JavaScript strings that uses the backtick character (`). Strings defined in this way may span multiple lines and include string substitutions.
texture (in Piu)
An object that provides an image to be drawn (entirely or in part) by one or more skins. An instance of the Texture class
, it’s specified in a skin’s texture property.
TLS (Transport Layer Security)
A low-level tool
for securing communication that works with many different protocols, including HTTP; a more recent version of Secure Sockets Layer (SSL).
to-tween (in Piu)
A tween, added to a timeline by the timeline’s to method, that modifies the properties of the target object from its current values to the target values specified in the properties object over duration milliseconds.
topic (in MQTT)
In the MQTT protocol, an organizational unit for messages. Messages to and from an MQTT server are organized into topics; a particular server may support many topics, but a client receives only the messages for the topics it subscribes to.
tween (in Piu)
A description of what happens to a specified content object in a timeline. Each tween describes how one or more properties of the object change from an initial value and an ending value. See also from-tween and to-tween.
typed array
A view in which you can wrap an ArrayBuffer to access the data in it; a collection of classes (subclasses of TypedArray for specific types) that let you work with arrays of integers and floating-point values stored in an ArrayBuffer. See also data view.
update area (in Poco)
The initial drawing area, defined by Poco’s begin method. It can be restricted by clipping; see also clipping area.
WebSocket
A peer-to-peer protocol whereby two devices communicate over a persistent network connection enabling efficient communication of brief messages. Unlike HTTP, in which only the client can make a request and the server always responds, WebSocket enables both devices to send and receive messages.
XS
A JavaScript engine optimized for resource-constrained environments such as microcontrollers. XS implements the full JavaScript language and supports on-device debugging, unlike other engines for embedded use. Created by Kinoma, XS is maintained by Moddable as the core of the Moddable SDK.
XS in C
A low-level C API provided by the XS JavaScript engine so that you can integrate C code into your JavaScript projects (or JavaScript code into your C projects).