mediawiki.page.watch: Deprecate mw.page object
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 23 May 2017 19:30:35 +0000 (21:30 +0200)
committerKrinkle <krinklemail@gmail.com>
Tue, 23 May 2017 20:04:45 +0000 (20:04 +0000)
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

index 6f52cbf..6322ccd 100644 (file)
@@ -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)
        }
 
        // 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' );