m (Typo) |
m (admin rename to User:MACH-59330) |
||
(11 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Infobox JavaScript |
{{Infobox JavaScript |
||
− | | Description = Provides a |
+ | | Description = Provides a promise variable for detection of the Message Wall feature on a wiki. |
+ | | Author = |
||
− | | Scope = Site-wide<br />Personal |
||
− | + | * [[User:Colouratura|Colouratura]] |
|
+ | * [[User:KockaAdmiralac|KockaAdmiralac]] |
||
− | | Updated = July 09, 2017 |
||
+ | * [[User:MACH-59330|MACH-59330]] |
||
⚫ | |||
− | | |
+ | | Scope = ps |
+ | | Updated = {{Updated|MediaWiki:wgMessageWallsExist.js}} |
||
⚫ | |||
+ | | Type = libraries |
||
}} |
}} |
||
− | |||
'''wgMessageWallsExist''' extends the <code>mw.config</code> variable to add a new wgVariable called <code>wgMessageWallsExist</code>. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages. |
'''wgMessageWallsExist''' extends the <code>mw.config</code> variable to add a new wgVariable called <code>wgMessageWallsExist</code>. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages. |
||
== Usage == |
== Usage == |
||
⚫ | |||
− | To '''import''' and use this script please make sure it is included '''before''' the script that uses it so that it is loaded in time to be used. |
||
<syntaxhighlight lang="javascript"> |
<syntaxhighlight lang="javascript"> |
||
+ | mw.hook('dev.enablewallext').add(function(wgMessageWallsExist) { |
||
− | importArticles({ |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | importArticle({ |
||
type: 'script', |
type: 'script', |
||
+ | article: 'u:dev:MediaWiki:WgMessageWallsExist.js' |
||
− | articles: [ |
||
⚫ | |||
− | // Scripts that depend on it |
||
⚫ | |||
}); |
}); |
||
− | </syntaxhighlight> |
||
− | |||
⚫ | |||
− | |||
− | <syntaxhighlight lang="javascript"> |
||
− | mw.config.get('wgMessageWallsExist').then( |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</syntaxhighlight> |
</syntaxhighlight> |
Revision as of 11:50, 14 March 2019
wgMessageWallsExist extends the mw.config
variable to add a new wgVariable called wgMessageWallsExist
. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages.
Usage
To use do as follows:
mw.hook('dev.enablewallext').add(function(wgMessageWallsExist) {
wgMessageWallsExist.then(
function () {
// Message walls do exist on this wiki
},
function () {
// Message walls do not exist on this wiki
}
);
});
importArticle({
type: 'script',
article: 'u:dev:MediaWiki:WgMessageWallsExist.js'
});