MMOframework
Why AI Playground Libraries Developers Agency
FR EN
Build a project live
Index

Idle

MMO.oauth · 1 symbol · generated 30 Nov 2026

class

Idle

idle.js:11

The end of a session left idle (AccessController::$idleTimeout, MMO.config.user.idle): the server ends it once no request came for timeout seconds, so the page warns warning seconds before, offering to stay logged in (a request: user/config.json), and shows the login page once it is over. Every request of the page counts, as on the server: a fetch() resets the count. Nothing happens on a page without MMO.config.user.idle

class MMO.oauth.Idle
Namespace
MMO.oauth
new MMO.oauth.Idle({timeout: 1800, warning: 120, ping: MMO.user.urls.config}).start();

Index

constructor(options, now)
state(last, now)
left()
touch()A request was made: the server counts from now
start()Check every 10 seconds, and count the page's own requests
check()

Methods6

constructor(options, now)

idle.js:16
constructor(options, now = () => Date.now())
options
now = () => Date.now()function(): numberthe time in milliseconds (a test gives its own)

state(last, now)

idle.js:31
state(last = this.last, now = this.now())
last = this.lastnumberwhen the last request was, in milliseconds
now = this.now()number
returns'active' | 'warning' | 'expired'where a session of this timeout stands

left()

idle.js:38
left()
returnsnumberthe seconds left before the session ends

touch()

idle.js:43

A request was made: the server counts from now

touch()

start()

idle.js:49

Check every 10 seconds, and count the page's own requests

start()