Skip to content

Commit

Permalink
Merge pull request #42 from gerads/master
Browse files Browse the repository at this point in the history
Check that game.keybindings exists before using
  • Loading branch information
mclemente authored May 26, 2022
2 parents 57af6dc + f5d4f69 commit 45ecbcf
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions party-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,36 @@ Hooks.once("init", () => {
registerApiSettings();
partyOverview = new PartyOverviewApp();

game.keybindings.register("party-overview", "openPartyOverview", {
name: game.i18n.localize("party-overview.keybinds.open.name"),
hint: game.i18n.localize("party-overview.keybinds.open.hint"),
onDown: () => {
partyOverview.render(true);
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
game.keybindings.register("party-overview", "closePartyOverview", {
name: game.i18n.localize("party-overview.keybinds.close.name"),
hint: game.i18n.localize("party-overview.keybinds.close.hint"),
onDown: () => {
partyOverview.close();
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
game.keybindings.register("party-overview", "togglePartyOverview", {
name: game.i18n.localize("party-overview.keybinds.toggle.name"),
hint: game.i18n.localize("party-overview.keybinds.toggle.hint"),
onDown: () => {
if (!partyOverview.rendering) partyOverview.render(true);
else partyOverview.close();
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
if (game.keybindings) {
game.keybindings.register("party-overview", "openPartyOverview", {
name: game.i18n.localize("party-overview.keybinds.open.name"),
hint: game.i18n.localize("party-overview.keybinds.open.hint"),
onDown: () => {
partyOverview.render(true);
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
game.keybindings.register("party-overview", "closePartyOverview", {
name: game.i18n.localize("party-overview.keybinds.close.name"),
hint: game.i18n.localize("party-overview.keybinds.close.hint"),
onDown: () => {
partyOverview.close();
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
game.keybindings.register("party-overview", "togglePartyOverview", {
name: game.i18n.localize("party-overview.keybinds.toggle.name"),
hint: game.i18n.localize("party-overview.keybinds.toggle.hint"),
onDown: () => {
if (!partyOverview.rendering) partyOverview.render(true);
else partyOverview.close();
},
onUp: () => {},
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
});
}
return loadTemplates([
"modules/party-overview/templates/parts/Tabs.html",
"modules/party-overview/templates/parts/FilterButton.html",
Expand Down

0 comments on commit 45ecbcf

Please sign in to comment.