The StorytellerListViewDelegate
can be used to handle events from the Story list. To define delegate methods, set the delegate
property on a Storyteller List.
const storyRow = new Storyteller.RowView('row-id');
storyRow.delegate = {
...
};
You can implement these optional methods when responding to the StorytellerListViewDelegate
protocol:
onStoriesDataLoadStarted: () => void
- called when the network request to load data for all Stories has startedonStoriesDataLoadComplete: (success: boolean, error: Error | null, dataCount: number) => void
- called when the data loading network request is complete
success
: whether or not the request was successfulerror
: the HTTPRequestError
if the request was not successfuldataCount
: the number of Stories loadedonStoryDismissed: () => void
- called when any Story has been dismissedonUserActivityOccurred: (type: ActivityType, data: UserActivityData) => void
- called when an analytics event is triggeredtileBecameVisible: (storyIndex: number) => void
- called whenever a tile is visible in the Story viewonError: (error: Error) => void
- called when an error is uncaught within the SDK. Use this for general error handlingonShareButtonClicked: (text: string, title: string, url: string) => void
- called when the user clicks the share button on a Story Page. This method can be used to override the default share behaviorgetAdConfig: () => AdConfig | null
- Implement this to display ads in the Stories on your site. More information can be found on the Ads Pageinterface IListDelegate {
onStoriesDataLoadStarted: () => void;
onStoriesDataLoadComplete: (
success: boolean,
error: Error | null,
dataCount: number
) => void;
onStoryDismissed: () => void;
onUserActivityOccurred: (type: ActivityType, data: UserActivityData) => void;
tileBecameVisible: (storyIndex: number) => void;
onError: (error: Error) => void;
onShareButtonClicked?: (text: string, title: string, url: string) => void;
getAdConfig: () => AdConfig | null;
}