du.user
Module for managing user interactions.Requires:
d3@v4idle
du.user.idle(period, action)
Adds an idle action, that is, a callback function that is triggered once the user have not interacted with the page for some time.
| arg | type | description |
|---|---|---|
| period | number | Time duration between consecutive calls. |
| action | function | Action to trigger once the waiting time elapsed. |
leave
du.user.leave(callback)
Triggers a callback once the browser tab of the dashboard is out of focus.
| arg | type | description |
|---|---|---|
| callback | function | Callback to call when browser tab is out of focus. |
enter
du.user.enter(callback)
Triggers a callback once the browser tab of the dashboard is in focus.
| arg | type | description |
|---|---|---|
| callback | function | Callback to call when browser tab is in focus. |
enable
du.user.enable()
Enables user interactions by removing the pointer-event restriction on .
disable
du.user.disable()
Disables user interaction by setting pointer-events to none on .
noContext
du.user.noContext()
Disables context menu for the page.
du.user.cheats
Namespace for cheat codes that trigger some events.egg
du.user.cheats.egg(name, cheat)
Adds a single Easter egg. An Ester egg is a one-time irreversible cheat. Once activated, it will be persistent until page reload.
| arg | type | description |
|---|---|---|
| name | string | Code to activate egg with. |
| cheat | function | Cheat to call once activated. |
feature
du.user.cheats.feature(name, enable, disable)
Adds a feature. A feature is a cheat that can be enabled/disabled. To enable the feature type the code name starting with "enable". To disable the feature, type the code name starting with "disable".
| arg | type | description |
|---|---|---|
| name | string | Name of the feature. Code to activate is enable+ |
| enable | function | Callback once feature is enabled. |
| disable | function | Callback once feature is disabled. |