Feed Stock Element

You can use this Stock Element by extending the exported global: window.casthub.elements.feed

The Feed Stock Element renders a scrollable live-feed for easy consumption of time-based events. For example, we use the Feed Stock Element in the various Service Feeds, such as the Twitch Feed Module.

Adding or Removing Items

You can add or remove Items from the List using the add and remove methods. The signature for these methods is super-simple:

  • add(id, item) - Items must have a unique id!
  • remove(id) - Removes an Item based on the unique id.

Item Definition

When adding an Item object, it must follow a given definition.

{
    // All Items are required to have a text body.
    text: 'Anonymous just subscribed!',
    // One of the Icons supported by CastHub.
    icon: 'twitch',
    // Icon can also be an Object if you want to define a color.
    icon: {
        type: 'twitch',
        color: '#FF0000',
    },
    /**
     * By default, the date will be relative to the time the Item was added.
     * However, you can specify your own millisecond UNIX timestamp:
     */
    date: (new Date()).getTime(),
}