du.user

Module for managing user interactions.

Requires: d3@v4

idle

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.
argtypedescription
periodnumberTime duration between consecutive calls.
actionfunctionAction 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.
argtypedescription
callbackfunctionCallback 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.
argtypedescription
callbackfunctionCallback 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.
argtypedescription
namestringCode to activate egg with.
cheatfunctionCheat 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".
argtypedescription
namestringName of the feature. Code to activate is enable+, code to deactivate is disable+.
enablefunctionCallback once feature is enabled.
disablefunctionCallback once feature is disabled.