Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Navigator.addIdleObserver()

이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox OS for internal applications only.

Summary

This method is used to add an observer that will check if the user is idle and will act accordingly. Once an observer is added, it can be removed with Navigator.removeIdleObserver.

Syntax

navigator.addIdleObserver(IdleObserver);

Parameters

IdleObserver
An object with specific properties to handle if the user is idle or not; see IdleObserver below.

IdleObserver

The IdleObserver is any object with the three following properties:

time
The time (expressed in seconds) before the user is considered idle.
onidle
A function called when the user is considered idle.
onactive
A function called when the user becomes active again.

Example

var myObserver = {
  time: 10,
  onidle: function () {
    console.log("The user is idle for 10 seconds");
  },
  onactive: function () {
    console.log("The user is now active again");
  }
}

navigator.addIdleObserver(myObserver);

Specification

Not part of any specification yet; however, this API will be discussed at W3C as part of the System Applications Working Group.

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: teoli, kscarfone, Sheppy, Jeremie, ztooner, Sicking
 최종 변경: teoli,