Page MenuHomePhabricator

Remove unused mw.Map#exists(Array selection) signature
Closed, ResolvedPublic

Description

Migration guide
JavaScript code for checking multiple keys via mw.config.exists([multiple]) or mw.user.tokens.exists([multiple]) will no longer work. If your script makes use of this, use exists() or get() with a single key instead.
Example (1)
  if (
-   mw.config.exists( [
-     'wgTitle'
-     'wgPageName'
-    ] )
+   mw.config.exists( 'wgTitle' ) &&
+   mw.config.exists( 'wgPageName' )
  ) {
    console.log( 'Condition reached.' );
  }
Example (2)
- if ( mw.config.exists( [ 'wgTitle' 'wgPageName' ] ) ) {
+ if ( mw.config.get( 'wgTitle' ) && mw.config.get( 'wgPageName' ) ) 
    console.log( 'Condition reached.' );
  }
Known usage

None. There seem to be zero search results from all user scripts, gadgets and site scripts on public WMF wikis. And also no search results from any Gerrit repos (except for its definition and test).

Event Timeline

Krinkle renamed this task from Remove unused mw.config.exists(Array selection) signature to Remove unused mw.Map#exists(Array selection) signature.May 5 2020, 3:23 AM
Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

Change 594345 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Remove unused mw.Map#exists method

https://gerrit.wikimedia.org/r/594345

Krinkle triaged this task as Medium priority.May 12 2020, 5:24 PM

Change 594345 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Remove unused mw.Map#exists method

https://gerrit.wikimedia.org/r/594345