方法簽章 Subscribable.subscribe
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
允許新增回呼。每當值更新時,系統就會呼叫這個回呼。
簽名
subscribe(callback: (value: T) => void): () => void;
詳細資料
參數
名稱 |
類型 |
選用 |
說明 |
callback |
(value: T) => void |
否 |
|
傳回
() => void
取消訂閱函式。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Method signature Subscribable.subscribe\n\n| **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features. \n|\n| **To use the Meet Media API to access real-time media from a conference, the Google Cloud project, OAuth principal, and all participants in the conference must be enrolled in the Developer Preview Program.**\n\nAllows a callback to be added. This callback will be called whenever the value\nis updated.\n\nSignature\n---------\n\n subscribe(callback: (value: T) =\u003e void): () =\u003e void;\n\nDetails\n-------\n\n| Optional | No |\n|----------|----|\n\nParameters\n----------\n\n| Name | Type | Optional | Description |\n|------------|----------------------|----------|-------------|\n| `callback` | `(value: T) =\u003e void` | No | |\n\nReturns\n-------\n\n`() =\u003e void`\n\nAn unsubscribe function."]]