Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface with all the methods supported by the jQuery Idle Timer plugin. These metods are available on JQuery instances as well as on the static JQuery object:

$.idleTimer(); // shortcut for the below
$( document ).idleTimer();

Hierarchy

Index

Methods

Methods

  • idleTimer(element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(idleTimeoutMillis: number, element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(options: Partial<IdleTimerOptions>, element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(method: "destroy", element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(method: "pause", element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(method: "resume", element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(method: "reset", element?: HTMLElement | Document, id?: string): IdleTimerMethods
  • idleTimer(method: "getRemainingTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "getElapsedTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "getLastActiveTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "isIdle", element?: HTMLElement | Document, id?: string): boolean
  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer();

    // binds to document - explicit
    $( document ).idleTimer();

    // bind to different element
    $( "#myTextArea" ).idleTimer();
    });

    Parameters

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer(1000);

    // binds to document - explicit
    $( document ).idleTimer(1000);

    // bind to different element
    $( "#myTextArea" ).idleTimer(1000);
    });

    Parameters

    • idleTimeoutMillis: number

      The timeout period in milliseconds.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer({
    timeout:10000,
    idle:true
    });

    // binds to document - explicit
    $( document ).idleTimer({
    timeout:10000,
    idle:true
    });

    // bind to different element
    $( "#myTextArea" ).idleTimer({
    timeout:10000,
    idle:true
    });
    });

    Parameters

    • options: Partial<IdleTimerOptions>

      The options for this idle timer. Any options not specified explicitly are set to their default values.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • Stop the timer, removes data, removes event bindings to come back from this you will need to instantiate again.

    Parameters

    • method: "destroy"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • Saves the remaining time, and stops the timer.

    Parameters

    • method: "pause"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • Starts the timer with remaining time saved when pause was called.

    Parameters

    • method: "resume"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • Restore initial idle state, and restart the timer.

    Parameters

    • method: "reset"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns IdleTimerMethods

    this JQuery instance for chaining.

  • Get time left until idle. If currently idle, returns 0.

    Parameters

    • method: "getRemainingTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    The time in milliseconds until the user goes idle. If user is already idle, returns 0.

  • Get time elapsed since the user went idle or active.

    • If currently idle, how long the user has been idle.
    • If currently active, how long the user has been active.

    Parameters

    • method: "getElapsedTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    How long the user has been idle or active, in milliseconds.

  • Get time the last active.idleTimer event was fired.

    Parameters

    • method: "getLastActiveTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    A timestamp (milliseconds since 1 January 1970 UTC) for when the most recent time the user went from idle to active.

  • Get whether the user is currently idle.

    Parameters

    • method: "isIdle"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns boolean

    true if the user is currently idle, or false if the user is currently active.

Generated using TypeDoc