CustomPropertyAccess
Access to the Custom Model's custom Properties. For a Property whose Name for JS Access is temperature, use this.property.temperature to read its value or assign a new value. Structured members can be accessed through their member names (for example, this.property.motor.speed).
A Custom Property can be bound to an EBX Variable or another Property to exchange Device data through EBX bindings.
js
const current = this.property.temperature;
this.property.overLimit = current > this.property.alarmLimit;Methods
$subscribe(path, callback)
Monitors changes to a custom Property or a structured member. The callback receives the new value followed by the old value.
| Parameter | Type | Description |
|---|---|---|
path | String | Name for JS Access, optionally followed by a dotted member path, such as motor.speed. |
callback | function | Called as callback(newValue, oldValue). |
Returns: Number — Subscription ID to pass to $unsubscribe.
js
const id = this.property.$subscribe('temperature', (newValue, oldValue) => {
console.log(newValue, oldValue);
});$unsubscribe(subscriptionId)
Stops a Property change subscription created by $subscribe.
| Parameter | Type | Description |
|---|---|---|
subscriptionId | Number | The ID returned by $subscribe. |
js
this.property.$unsubscribe(id);