summaryrefslogtreecommitdiff
path: root/resources/mediawiki/mediawiki.notify.js
blob: 743d65172864d8d083ebc5559dc4632c4a147423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * @class mw.plugin.notify
 */
( function ( mw, $ ) {
	'use strict';

	/**
	 * @see mw.notification#notify
	 * @param message
	 * @param options
	 * @return {jQuery.Promise}
	 */
	mw.notify = function ( message, options ) {
		var d = $.Deferred();
		// Don't bother loading the whole notification system if we never use it.
		mw.loader.using( 'mediawiki.notification', function () {
			// Call notify with the notification the user requested of us.
			d.resolve( mw.notification.notify( message, options ) );
		}, d.reject );
		return d.promise();
	};

	/**
	 * @class mw
	 * @mixins mw.plugin.notify
	 */

}( mediaWiki, jQuery ) );