ลายเซ็นเมธอด MeetAddonClient.on
ให้สิทธิ์เข้าถึง
AddonCallbacks
ที่ส่วนเสริมสามารถใช้ได้
ลายเซ็น
on<T extends keyof AddonCallbacks>(
eventId: T,
eventHandler: AddonCallbacks[T],
): void;
พารามิเตอร์ประเภท
รายละเอียด
พารามิเตอร์
ชื่อ |
ประเภท |
ไม่บังคับ |
คำอธิบาย |
eventId |
T |
ไม่ได้ |
|
eventHandler |
AddonCallbacks[T] |
ไม่ได้ |
|
การคืนสินค้า
void
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-10-15 UTC
[null,null,["อัปเดตล่าสุด 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"]]