mediawiki-skins-Vector/resources/mediawiki.d.ts
Jan Drewniak 1dad545f63 Adds loading indicator for new search module
Provides a loading indicator to show while the new Vue.js based
search widget loads. Given that the new widget will pull down the
entire Vue.js runtime, it's likely that there will be a delay
before the search suggestions appear. This loader is meant to
improve the perceived loading experience of the new widget.

Adds:
- New searchLoader.js file containing loading behaviour.
  - This overrides the code searchSuggest loading behaviour.
- New SearchBoxLoader.less file containing the loader styles.
- i18n message: 'vector-search-loader'.
- The Event type to jsdoc.json

Bug: T254695
Change-Id: I6b5f0a60018954e10b9e80792030b67b2ec33e5a
2020-09-08 13:59:41 +00:00

60 lines
1.6 KiB
TypeScript

interface MwApi {
saveOption( name: string, value: unknown ): JQuery.Promise<any>;
}
type MwApiConstructor = new( options?: Object ) => MwApi;
interface MediaWiki {
util: {
/**
* Return a wrapper function that is debounced for the given duration.
*
* When it is first called, a timeout is scheduled. If before the timer
* is reached the wrapper is called again, it gets rescheduled for the
* same duration from now until it stops being called. The original function
* is called from the "tail" of such chain, with the last set of arguments.
*
* @since 1.34
* @param {number} delay Time in milliseconds
* @param {Function} callback
* @return {Function}
*/
debounce(delay: number, callback: Function): () => void;
};
Api: MwApiConstructor;
config: {
get( configKey: string|null ): string;
},
loader: {
/**
* Execute a function after one or more modules are ready.
*
* @param moduleName
*/
using( moduleName: string|null ): JQuery.Promise<any>;
/**
* Load a given resourceLoader module.
*
* @param moduleName
*/
load( moduleName: string|null ): () => void;
/**
* Get the loading state of the module.
* On of 'registered', 'loaded', 'loading', 'ready', 'error', or 'missing'.
*
* @param moduleName
*/
getState( moduleName: string|null ): string;
},
/**
* Loads the specified i18n message string.
* Shortcut for `mw.message( key, parameters... ).text()`.
*
* @param messageName i18n message name
*/
msg( messageName: string|null ): string;
}
declare const mw: MediaWiki;