mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 11:46:55 +00:00
27 lines
488 B
JavaScript
27 lines
488 B
JavaScript
|
( function ( mw, $ ) {
|
||
|
|
||
|
/**
|
||
|
* Sugar around `window.setTimeout`.
|
||
|
*
|
||
|
* @example
|
||
|
* function continueProcessing() {
|
||
|
* // ...
|
||
|
* }
|
||
|
*
|
||
|
* mw.popups.wait( 150 ).then( continueProcessing );
|
||
|
*
|
||
|
* @param {Number} delay The number of milliseconds to wait
|
||
|
* @return {jQuery.Deferred}
|
||
|
*/
|
||
|
mw.popups.wait = function ( delay ) {
|
||
|
var result = $.Deferred();
|
||
|
|
||
|
setTimeout( function () {
|
||
|
result.resolve();
|
||
|
}, delay );
|
||
|
|
||
|
return result.promise();
|
||
|
};
|
||
|
|
||
|
}( mediaWiki, jQuery ) );
|