Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Feedback on Idle API

3 views
Skip to first unread message

David Bruant

unread,
Nov 6, 2012, 8:09:43 AM11/6/12
to dev-w...@lists.mozilla.org
Hi,

My comments are based on the wiki page [1].

# I'm puzzled as to why the API is not using the regular DOMEvent
addEventListener/removeEventListener [2]. Web/app developers are used to
this API already.
Maybe something like:

// sorry for the awful API names.
var fourSecondfInactivity = new InactivityEventTarget(4 /*duration*/)
fourSecondfInactivity.addEventListener('idle', function(){})
fourSecondfInactivity.addEventListener('active', function(){})

I am tempted to suggest navigator.addEventListener('idle4s',
function(){}) because it's a bit hacky and ugly, but it could work too.


# Another idea to solve the privacy/security issue is to rely one
page-visibility [2]. If the page visibility changes, just abort all
idleobservers (because it's not relevant any longer).
Now, my point arises another threat. The user switching from
privacy-mode window to non-privacy mode window fires at about the same
time one pagevisibilityevent in each (with opposite values). I have
moved the threat from the idle API to the pagevibility API, but the good
news is that the pagevibility threat has to be dealt with anyways and
solving it solves both cases.

David

[1] https://wiki.mozilla.org/WebAPI/IdleAPI
[2] http://www.w3.org/TR/DOM-Level-3-Events/#interface-EventTarget
[3] http://www.w3.org/TR/page-visibility/
0 new messages