Add abnormal binds to help page

That was about 1000x easier than I was expecting. Thanks @glacambre!
This commit is contained in:
Oliver Blanthorn 2018-07-26 10:38:54 +01:00
parent 756c29673a
commit e0f9fa4e45
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 22 additions and 9 deletions

View file

@ -31,6 +31,14 @@
A "splat" operator (...) means that the excmd will accept any number of space-delimited arguments into that parameter.
Above each function signature you will see any aliases or key sequences bound to it. The internal names for the various modes are used, which are listed here:
- `nmaps`: normal mode binds
- `imaps`: insert mode binds
- `inputmaps`: input mode binds
- `ignoremaps`: ignore mode binds
- `exaliases`: aliases in the command mode
You do not need to worry about types. Return values which are promises will turn into whatever they promise to when used in [[composite]].
At the bottom of each function's help page, you can click on a link that will take you straight to that function's definition in our code. This is especially recommended for browsing the [config](/static/docs/modules/_src_config_.html#defaults) which is nigh-on unreadable on these pages.

View file

@ -88,19 +88,24 @@ async function addSetting(settingName: string) {
browser.storage.onChanged.addListener((changes, areaname) => {
if ("userconfig" in changes) {
// JSON.stringify for comparisons like it's 2012
;["exaliases", "nmaps"].forEach(kind => {
if (
JSON.stringify(changes.userconfig.newValue[kind]) !=
JSON.stringify(changes.userconfig.oldValue[kind])
)
addSetting(kind)
})
;["nmaps", "imaps", "ignoremaps", "inputmaps", "exaliases"].forEach(
kind => {
if (
JSON.stringify(changes.userconfig.newValue[kind]) !=
JSON.stringify(changes.userconfig.oldValue[kind])
)
addSetting(kind)
},
)
}
})
addEventListener("load", async () => {
await addSetting("exaliases")
await addSetting("nmaps")
await Promise.all(
["nmaps", "imaps", "ignoremaps", "inputmaps", "exaliases"].map(
addSetting,
),
)
// setCommandSetting() can change the height of nodes in the page so we need to scroll to the right place again
if (document.location.hash) {
document.location.hash = document.location.hash