Line data Source code
1 : import { toRaw } from 'vue'
2 :
3 : import { KeyComboImpl } from './keyCombo'
4 : import type { Keybinding } from './types'
5 :
6 2356 : export class KeybindingImpl implements Keybinding {
7 : commandId: string
8 : combo: KeyComboImpl
9 : targetElementId?: string
10 :
11 : constructor(obj: Keybinding) {
12 82495 : this.commandId = obj.commandId
13 82495 : this.combo = new KeyComboImpl(obj.combo)
14 82495 : this.targetElementId = obj.targetElementId
15 : }
16 :
17 : equals(other: unknown): boolean {
18 36 : const raw = toRaw(other)
19 :
20 36 : return raw instanceof KeybindingImpl
21 : ? this.commandId === raw.commandId &&
22 : this.combo.equals(raw.combo) &&
23 : this.targetElementId === raw.targetElementId
24 : : false
25 : }
26 : }
|