Timeout autoHide notifications based on visible time
authorErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 21 Sep 2017 16:13:01 +0000 (09:13 -0700)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 7 Nov 2017 23:12:30 +0000 (00:12 +0100)
commitb41f6663957bcd581926dc29d1dfdad4d3ce511e
tree6af82ce93d94e910c5b0aac16b0423241c256cca
parent6fa1bd7682f5fbe8f74fcf2b29b85a98a4387441
Timeout autoHide notifications based on visible time

On supported browsers handle the auto hide timeout with a
count of cumulative time the page has been visible to the
user. Old functionality can still be accessed, if desired,
by setting the visibleTimeout notification option to false.
On browsers without support for this visibilitychange event
wall clock time (the old behaviour) is used.

Adds a library function functionally similar to setTimeout that
only considers time when the page is visible. This is useful
both for analytics purposes, and when you want to temporarily
put something on screen and be reasonably certain it doesn't
go away until a user has seen it.

Bug: T42322
Change-Id: I7d8ea85602cae9cfc72e0155bc3092049ecafd43
maintenance/jsduck/categories.json
resources/Resources.php
resources/src/mediawiki/mediawiki.notification.js
resources/src/mediawiki/mediawiki.visibleTimeout.js [new file with mode: 0644]
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/mediawiki/mediawiki.visibleTimeout.test.js [new file with mode: 0644]