Implementing StorytellerListViewDelegate Callbacks

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 = {

Delegate Methods

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 started
  • onStoriesDataLoadComplete: (success: boolean, error: Error | null, dataCount: number) => void - called when the data loading network request is complete
    • success: whether or not the request was successful
    • error: the HTTPRequestError if the request was not successful
    • dataCount: the number of Stories loaded
  • onStoryDismissed: () => void - called when any Story has been dismissed
  • onUserActivityOccurred: (type: ActivityType, data: UserActivityData) => void - called when an analytics event is triggered
  • tileBecameVisible: (storyIndex: number) => void - called whenever a tile is visible in the Story view
  • onError: (error: Error) => void - called when an error is uncaught within the SDK. Use this for general error handling
  • onShareButtonClicked: (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 behavior
  • getAdConfig: () => AdConfig | null - Implement this to display ads in the Stories on your site. More information can be found on the Ads Page
interface 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;
Forward Arrow