X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/resources/src/mediawiki/mediawiki.notify.js diff --git a/resources/src/mediawiki/mediawiki.notify.js b/resources/src/mediawiki/mediawiki.notify.js new file mode 100644 index 00000000..0f3a0867 --- /dev/null +++ b/resources/src/mediawiki/mediawiki.notify.js @@ -0,0 +1,28 @@ +/** + * @class mw.plugin.notify + */ +( function ( mw ) { + 'use strict'; + + /** + * @see mw.notification#notify + * @see mw.notification#defaults + * @param {HTMLElement|HTMLElement[]|jQuery|mw.Message|string} message + * @param {Object} options See mw.notification#defaults for details. + * @return {jQuery.Promise} + */ + mw.notify = function ( message, options ) { + // Don't bother loading the whole notification system if we never use it. + return mw.loader.using( 'mediawiki.notification' ) + .then( function () { + // Call notify with the notification the user requested of us. + return mw.notification.notify( message, options ); + } ); + }; + + /** + * @class mw + * @mixins mw.plugin.notify + */ + +}( mediaWiki ) );