A delegate is an object of callback functions that the SDK calls when
something happens. Storyteller has one global delegate, and each view has its
own delegate. Every callback is optional.
Set the global delegate before you call initialize, so that it receives the
sdkInitialized event. Assigning a delegate replaces the previous one:
callbacks you leave out of the new object stop being called.
{"slug": "delegates-index", "page_title": "Callback Overview", "page_url": "delegates/", "canonical_url": "/web/delegates/", "markdown": "# Handle delegates and callbacks {#delegate-callbacks}\n\nA delegate is an object of callback functions that the SDK calls when\nsomething happens. Storyteller has one global delegate, and each view has its\nown delegate. Every callback is optional.\n\n## Delegate types\n\n| What you want to handle | TypeScript type | Where you set it | Guide |\n| --- | --- | --- | --- |\n| Analytics events, share taps, ad requests, and in-app action links from every Story and Clips player | `IStorytellerDelegate` | `Storyteller.sharedInstance.delegate` | [Handle global callbacks](../StorytellerDelegate.md) |\n| Loading and player dismissal for one row or grid | `IListViewDelegate` | The row or grid's `delegate` property | [Handle view callbacks](../StorytellerListViewDelegate.md) |\n| Loading, dismissal, and the back button for one Clips player view | `IStorytellerClipsPlayerDelegate` | The `delegate` property of a `StorytellerClipsPlayerView` or `StorytellerEmbeddedClipsPlayerView` | [Handle view callbacks](../StorytellerListViewDelegate.md#clips-player-delegate) |\n\nSet the global delegate before you call `initialize`, so that it receives the\n`sdkInitialized` event. Assigning a delegate replaces the previous one:\ncallbacks you leave out of the new object stop being called.\n\n## Guides\n\n- [Handle global callbacks](../StorytellerDelegate.md)\n- [Handle view callbacks](../StorytellerListViewDelegate.md)\n- [Integrate analytics](../Analytics.md)\n- [Integrate ads](../Ads.md)\n- [API reference](../reference/index.md)\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}