mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-30 18:35:44 +00:00
8cf278d305
As part of comparing Vue search with legacy search, we need to track how long it takes to lazy load the wvui library. A similar metric was added to measuring the mediawiki.searchSuggest module in I0fa6b8904bd43c87a68e9161f00d686a0e588966. This commit adds the following metrics which will only be used in our synthetic tests. We are not doing RUM tests at this time. To test locally, add the following to your LocalSettings.php and append the query param `useskinversion=2` e.g. (http://localhost:8181/wiki/Test?useskinversion=2): ``` $wgVectorUseCoreSearch = false; ``` Marks: * mwVectorVueSearchLoadStart: Marks the start of loading the search module. * mwVectorVueSearchLoadEnd: Marks the end of loading the search module. Measures: * mwVectorVueSearchLoadStartToLoadEnd: Measures the time it takes to load the search module. Bug: T251544 Change-Id: I14e44b45a66213821d69cd22395fedbae747da88
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
interface MwApi {
|
|
saveOption( name: string, value: unknown ): JQuery.Promise<any>;
|
|
}
|
|
|
|
type MwApiConstructor = new( options?: Object ) => MwApi;
|
|
|
|
interface MediaWiki {
|
|
util: {
|
|
/**
|
|
* @param {string} id of portlet
|
|
*/
|
|
showPortlet( id: string ): () => void;
|
|
/**
|
|
* @param {string} id of portlet
|
|
*/
|
|
hidePortlet( id: string ): () => void;
|
|
/**
|
|
* @param {string} id of portlet
|
|
* @return {bool}
|
|
*/
|
|
isPortletVisible( id: string ): () => boolean,
|
|
/**
|
|
* 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
|
|
* @param {Function} ready Callback to execute when all dependencies are
|
|
* ready.
|
|
* @param {Function} after Callback to execute if one or more dependencies
|
|
* failed.
|
|
*/
|
|
using( moduleName: string|null, ready?: Function, error?: Function ): 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;
|