Bản khảo sát nghiên cứu: Cho chúng tôi biết trải nghiệm của bạn khi sử dụng Blockly
Bắt đầu khảo sát
chặn > ShortcutRegistry > đăng ký
Phương thức ShortcutRegistry.register()
Đăng ký phím tắt.
Chữ ký:
register(shortcut: KeyboardShortcut, opt_allowOverrides?: boolean): void;
Tham số
Thông số |
Loại |
Mô tả |
lối tắt |
KeyboardShortcut |
Phím tắt cho mã phím này. |
opt_allowOverrides |
boolean |
(Không bắt buộc) Bật để ngăn cảnh báo khi ghi đè một mục đã đăng ký. |
Trường hợp trả lại hàng:
void
Ngoại lệ
{Lỗi} nếu đã tồn tại một lối tắt có cùng tên.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-10-15 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-10-15 UTC."],[[["The `ShortcutRegistry.register()` method is used to register keyboard shortcuts within a Blockly application."],["It accepts a `KeyboardShortcut` object defining the shortcut and an optional boolean to suppress warnings when overriding existing shortcuts."],["Attempting to register a shortcut with a name that already exists will throw an error."]]],["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"]]