UNPKG

@overwolf/overwolf-api-ts

Version:

utilities and wrappers for common Overwolf API tasks

30 lines (29 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OWHotkeys = void 0; class OWHotkeys { constructor() { } static getHotkeyText(hotkeyId, gameId) { return new Promise(resolve => { overwolf.settings.hotkeys.get(result => { if (result && result.success) { let hotkey; if (gameId === undefined) hotkey = result.globals.find(h => h.name === hotkeyId); else if (result.games && result.games[gameId]) hotkey = result.games[gameId].find(h => h.name === hotkeyId); if (hotkey) return resolve(hotkey.binding); } resolve('UNASSIGNED'); }); }); } static onHotkeyDown(hotkeyId, action) { overwolf.settings.hotkeys.onPressed.addListener((result) => { if (result && result.name === hotkeyId) action(result); }); } } exports.OWHotkeys = OWHotkeys;