The callbacks that handle unfurls and refreshing.
Properties
afterUnfurlCallback()?
optional afterUnfurlCallback: (blockProxy, url) => Promise<void>;
Callback after initial unfurl
The purpose is to allow unfurlCallback to happen quickly, while afterUnfurlCallback handles longer running process
For example, preview image could be added in unfurlCallback,
but multiple thumbnails (or PDF conversion etc.) could be added in afterUnfurlCallback -
This callback is also used for refresh to re-fetch the information
Parameters
Parameter | Type | Description |
---|---|---|
blockProxy | LinkUnfurlBlockProxy | The block proxy of the unfurl block |
url | string | - |
Returns
Promise
<void
>
expandCallback()?
optional expandCallback: (blockProxy, url) => Promise<void>;
Callback upon clicking expand button.
Occurs before attempting to expand iframe.
Parameters
Parameter | Type | Description |
---|---|---|
blockProxy | LinkUnfurlBlockProxy | The block proxy of the unfurl block |
url | string | The url to unfurl |
Returns
Promise
<void
>
unfurlCallback()
unfurlCallback: (url) => Promise<undefined | UnfurlDetails | UnfurlRefreshErrorType>;
Callback upon initial unfurl.
This should return with minimal delay to get a partial unfurl shown to the user as quick as possible.
Final configuration of the unfurl should be done in afterUnfurlCallback.
This callback is also used for refresh to re-fetch the information
Parameters
Parameter | Type | Description |
---|---|---|
url | string | The url to unfurl |
Returns
Promise
<undefined
| UnfurlDetails
| UnfurlRefreshErrorType
>