← Torna al riferimento dell'API
Device A device
A tablet, phone or other computer registered with TRAX Control, as on the Devices page. It tells whether TRAX Control is open on it now, and when it comes or goes. The computer TRAX Control runs on is not a device.
A cosa serve: To react when the dispatcher's tablet arrives or leaves, or to do something only while a certain device is there.
devices.Tablet.onCame {
say "The dispatcher is here"
}
if (!devices.Tablet.isHere()) { log "no dispatcher" }Proprietà
name → String
The name it registered under.
The name the device registered under.
log devices.Tablet.nameMetodi
isHere → boolean
Whether it has TRAX Control open now.
Whether the device has a page of TRAX Control open now.
if (devices.Tablet.isHere()) say "the dispatcher is watching"Eventi
onCame → Device
When it opens TRAX Control while it had none open.
Fires when the device opens TRAX Control while it had none open.
devices.Tablet.onCame {
say "Welcome, dispatcher"
}onWent → Device
When it has had TRAX Control closed for a little while.
Fires when the device has had nothing of TRAX Control open for a while (about a minute); reloading does not count.
devices.Tablet.onWent {
log "tablet gone"
}