/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/cdk/keycodes/modifiers.ts
21 строка
625 B
Naji
docs: replace angular.io links with angular.dev (#29734)
19 сен 2024, 13:57
Не верифицирован
19 сен 2024, 13:57
5782834
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export type ModifierKey = 'altKey' | 'shiftKey' | 'ctrlKey' | 'metaKey'; /** * Checks whether a modifier key is pressed. * @param event Event to be checked. */ export function hasModifierKey(event: KeyboardEvent, ...modifiers: ModifierKey[]): boolean { if (modifiers.length) { return modifiers.some(modifier => event[modifier]); } return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey; }