Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
blockly > ShortcutRegistry > register
Metoda ShortcutRegistry.register()
Rejestruje skrót klawiszowy.
Podpis:
register(shortcut: KeyboardShortcut, allowOverrides?: boolean): void;
Parametry
Parametr |
Typ |
Opis |
skrót |
KeyboardShortcut |
Skrót do tego kodu klucza. |
allowOverrides |
wartość logiczna |
(Opcjonalnie) Wartość „PRAWDA” zapobiega wyświetlaniu ostrzeżenia podczas zastępowania już zarejestrowanego elementu. |
Zwroty:
void
Wyjątki
{Error}, jeśli skrót o tej samej nazwie już istnieje.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-25 UTC."],[],["The `register` method within `ShortcutRegistry` registers keyboard shortcuts. It accepts a `KeyboardShortcut` object, representing the shortcut, and an optional boolean, `opt_allowOverrides`. If `opt_allowOverrides` is true, it prevents warnings when overriding existing shortcuts. The method returns nothing (void). An error is thrown if a shortcut with the same name is already registered and the `opt_allowOverrides` is not set to true.\n"]]