mediawiki-extensions-Echo/modules/api/mw.echo.api.ForeignAPIHandler.js
Moriel Schottlender 0834b91f56 Echo API layer
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
2016-03-03 23:40:12 +00:00

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 );