<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 31, 2009, at 11:53 PM, Mike Wilson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Baskerville; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div dir="ltr"><font face="Verdana" size="2"><span class="298553706-01092009">This requirement could be solved in several other ways, f ex making sure that the "standard" timeout period is short enough to not be longer than what any app wants. Then (as was previously suggested) an app that wants a longer timeout can do setTimeout and trigger its own idle stuff if status has not come back to "active" during that time.</span></font></div></span></blockquote><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Baskerville; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div dir="ltr"><br></div><div dir="ltr">This seems reasonable. Different apps really do want different idle-time thresholds (if only for compatibility with other manifestations of the app, i.e. an IM platform), but I think the event-plus-custom-timeout mechanism would let them achieve that.</div><div dir="ltr"><br></div></span><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Baskerville; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div dir="ltr"><font face="Verdana" size="2"><span class="298553706-01092009">Another alternative is to have no event, and just a property:</span></font></div><div dir="ltr"><font face="Verdana" size="2"><span class="298553706-01092009">    window.lastUserActionTime</span></font></div><div dir="ltr"><font face="Verdana" size="2"><span class="298553706-01092009">which is kept updated with the "msec since epoch" for the latest user input on the desktop. Then an app can implement its own idle functionality with totally own rules. This API has the drawback of maybe exposing too much information (the rate of input events to other apps), but may spawn some ideas.</span></font></div></span></blockquote><br></div><div>This would have to be deliberately fuzzed, as it is apparently possible to guess user typing by looking at the timing between keystrokes. Rounding it to the nearest second would probably suffice.</div><div><br></div><div>The problem with this API is that, once the app determines the user is idle, it has to keep polling lastUserActionTime until it sees it change. I'm not fond of APIs that require the client to poll.</div><div><br></div><div>The best solution, I think, would be both of the above. The lastUserActionTime property lets a page test whether the user's already idle at the time it loads, and the event lets it detect transitions without having to poll.</div><div><br></div><div>—Jens</div><br></body></html>