fixed hotkey race condition

This commit is contained in:
Eugene Pankov 2021-08-08 17:54:53 +02:00
parent 79de7ec015
commit 434bacf185
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -72,7 +72,11 @@ export class HotkeysService {
@Inject(HotkeyProvider) private hotkeyProviders: HotkeyProvider[],
hostApp: HostAppService,
) {
this.config.ready$.toPromise().then(async () => {
const hotkeys = await this.getHotkeyDescriptions()
this.hotkeyDescriptions = hotkeys
const events = ['keydown', 'keyup']
events.forEach(eventType => {
document.addEventListener(eventType, (nativeEvent: KeyboardEvent) => {
this._keyEvent.next(nativeEvent)
@ -83,9 +87,6 @@ export class HotkeysService {
}
})
})
this.config.ready$.toPromise().then(async () => {
const hotkeys = await this.getHotkeyDescriptions()
this.hotkeyDescriptions = hotkeys
})
// deprecated