From b3fb2770d1a1eb8e1be688ff8582ecbf5847bc5b Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 23 May 2017 21:30:35 +0200 Subject: [PATCH] mediawiki.page.watch: Deprecate mw.page object Let's deprecate the mw.page object in the same way we did with mw.special. mw.page.watch is the only property that exists inside mw.page, and it's mostly internal. Let's expose that via module.exports instead (for use by Wikibase and VisualEditor). Change-Id: I0e6a95bd4fbaba06eae5137ac7af84f62bebf6f0 --- resources/src/mediawiki/page/watch.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/resources/src/mediawiki/page/watch.js b/resources/src/mediawiki/page/watch.js index 6f52cbfd37..6322ccd29d 100644 --- a/resources/src/mediawiki/page/watch.js +++ b/resources/src/mediawiki/page/watch.js @@ -5,8 +5,9 @@ * @class mw.page.watch.ajax */ ( function ( mw, $ ) { - // The name of the page to watch or unwatch - var title = mw.config.get( 'wgRelevantPageName' ); + var watch, + // The name of the page to watch or unwatch + title = mw.config.get( 'wgRelevantPageName' ); /** * Update the link text, link href attribute and (if applicable) @@ -96,11 +97,17 @@ } // Expose public methods - mw.page = { - watch: { - updateWatchLink: updateWatchLink - } + watch = { + updateWatchLink: updateWatchLink }; + module.exports = watch; + + // Deprecated since 1.30 + mw.log.deprecate( mw, 'page', + { watch: watch }, + 'Use require( \'mediawiki.page.watch.ajax\' ) instead.', + 'mw.page' + ); $( function () { var $links = $( '.mw-watchlink a, a.mw-watchlink' ); -- 2.20.1