Skip to content

RocketChat/rocketchat-chrome-presence

 
 

Repository files navigation

Chat Presence

Uses the idle status from browser API to set presence.

On Rocket.Chat this snippet must be added into the client:

window.addEventListener("message", function (event) {
    if ((event.source != window) || (event.data.name != 'rocketchat_presence')) {
        return;
    }

    if (event.data.type === "idlestatus") {
        var state = event.data.state;
        if (state === "idle") {
            UserPresence.setAway();
        } else if (state === "active") {
            UserPresence.setOnline();
        } else if (state === "locked") {
            UserPresence.setAway();
        }

    }
    else if (event.data.rocketchat_presence_extension) {
        // disabling the built in timer, use me!
        UserPresence.stopTimer();
        UserPresence.startTimer = function () { }
    }
});

Icons

Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 79.6%
  • HTML 15.5%
  • CSS 4.9%