Chữ ký phương thức MeetAddonClient.on
Cấp quyền truy cập vào
AddonCallbacks
mà tiện ích bổ sung có thể sử dụng.
Chữ ký
on<T extends keyof AddonCallbacks>(
eventId: T,
eventHandler: AddonCallbacks[T],
): void;
Thông số loại
Thông tin chi tiết
Thông số
Tên |
Loại |
Không bắt buộc |
Mô tả |
eventId |
T |
Không |
|
eventHandler |
AddonCallbacks[T] |
Không |
|
Giá trị trả về
void
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."],[[["Gives add-ons access to `AddonCallbacks` for utilizing various functionalities."],["Employs the `on` method, accepting an event ID and handler to manage add-on events."],["Utilizes generics for type safety and flexibility in handling different event types."],["Offers a parameter named `eventId` of a generic type `T` and an `eventHandler` with a type based on the provided `eventId`."],["Returns void, indicating it primarily focuses on event registration and execution rather than returning a specific value."]]],["The core functionality allows add-ons to subscribe to events defined within `AddonCallbacks`. The `on` method is used to register an `eventHandler` for a specific `eventId`. `eventId` must be a valid key within `AddonCallbacks`. The `eventHandler` is a function type that corresponds to the chosen `eventId` in `AddonCallbacks`. The method returns `void`, meaning it does not return any value.\n"]]