StorytellerListDelegate

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 behaviour
  • 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;
}
PREVIOUS
Forward Arrow