Class “InactivityTimer”
Object > NativeObject > InactivityTimer
A timer that triggers when the app has not been interacted with for a configurable interval.
| Type: | InactivityTimer extends NativeObject |
| Constructor: | public |
| Singleton: | No |
| Namespace: | tabris |
| Direct subclasses: | None |
| JSX Support: | No |
Examples
JavaScript
import {InactivityTimer} from 'tabris';
new InactivityTimer({delay: 2000})
.onTimeout(() => console.log('Inactive'));
See also:
JS inactivitytimer.js [► Run in Playground]
Constructor
new InactivityTimer(properties?)
| Parameter | Type | Description |
|---|---|---|
| properties | Properties<InactivityTimer> |
Sets all key-value pairs in the properties object as widget properties. Optional. |
Methods
cancel()
Stops and resets the timer.
Returns: undefined
start()
Starts the timer with the currently configured delay. After the first timeout event, the timer will stop but it can be started again.
Returns: undefined
Properties
delay
The interval of user inactivity that will trigger the timer. Given in milliseconds. Changes to this property will not affect a running timer.
| Type: | number |
| Default: | 0 |
| Settable: | Yes |
| Change Event: | delayChanged |
Events
timeout
Fired when the app has not been interacted with since the configured delay.
EventObject Type: EventObject<InactivityTimer>
This event has no additional parameter.
Change Events
delayChanged
Fired when the delay property has changed.
EventObject Type: PropertyChangedEvent<InactivityTimer, number>
| Property | Type | Description |
|---|---|---|
| value | number |
The new value of delay. |