diff --git a/README.md b/README.md index e2a875e..2351321 100644 --- a/README.md +++ b/README.md @@ -427,6 +427,26 @@ useEffect(() => { For even better experience, you can combine the previous two methods and re-fetch content from Delivery Preview API on the client-side to update affected placed while waiting for the rebuild process to finish. +### Real-time feedback in Web Spotlight + +Starting from version 3.2.0-next.0, Smart Link SDK support real-time feedback in Web Spotlight. If your preview website +uses the supported SDK version, Kontent.ai will send the updated elements to your website via the iframe communication +right after you update them in the in-context editor. + +**Please note, that your preview website won't update automatically, and it is up to you to decide how to handle this new event in your application.** + +#### Setting up real-time feedback in your app + +```ts +import KontentSmartLink, { KontentSmartLinkEvent } from '@kontent-ai/smart-link'; + +const sdk = KontentSmartLink.initialize({ ... }); + +sdk.on(KontentSmartLink.Update, (data) => { + // update the state of your app with the new data here +}); +``` + ### Using SDK inside and outside Web Spotlight When Kontent.ai Smart Link SDK is used outside Web Spotlight, it listens to the query parameters in the URL to toggle smart