mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-01 02:46:46 +00:00
0834b91f56
Split and refactor Echo network handling and create a proper API layer for the UI to use consistently. Split Echo's API methods into its own module so they can be loaded along with the initialization script and manage the API requests. Change-Id: I0526a14bb8cc0d9729a303e24ab6e43259cc86bb
42 lines
907 B
JavaScript
42 lines
907 B
JavaScript
( function ( mw, $ ) {
|
|
/**
|
|
* Foreign notification API handler
|
|
*
|
|
* @class
|
|
* @extends mw.echo.api.LocalAPIHandler
|
|
*
|
|
* @constructor
|
|
* @param {string} apiUrl A url for the access point of the
|
|
* foreign API.
|
|
* @param {Object} [config] Configuration object
|
|
*/
|
|
mw.echo.api.ForeignAPIHandler = function MwEchoApiForeignAPIHandler( apiUrl, config ) {
|
|
config = config || {};
|
|
|
|
// Parent constructor
|
|
mw.echo.api.ForeignAPIHandler.parent.call( this, config );
|
|
|
|
// Add 'noforn' setting to foreign APIs
|
|
$.extend( true, this.typeParams, {
|
|
message: {
|
|
notnoforn: 1,
|
|
notfilter: '!read'
|
|
},
|
|
alert: {
|
|
notnoforn: 1,
|
|
notfilter: '!read'
|
|
},
|
|
all: {
|
|
notnoforn: 1,
|
|
notfilter: '!read'
|
|
}
|
|
} );
|
|
|
|
this.api = new mw.ForeignApi( apiUrl );
|
|
};
|
|
|
|
/* Setup */
|
|
|
|
OO.inheritClass( mw.echo.api.ForeignAPIHandler, mw.echo.api.LocalAPIHandler );
|
|
} )( mediaWiki, jQuery );
|