Appearance
Class: HypeTrainService
Read and observe the channel's Twitch Hype Train.
Remarks
Available through k.twitch.hypeTrain. Use getStatus once to hydrate a widget, then the event callbacks to keep it current without polling.
Constructors
Constructor
ts
new HypeTrainService(): HypeTrainService;Returns
HypeTrainService
Methods
getStatus()
ts
getStatus(): Promise<HypeTrainStatus>;Gets the active Hype Train and the channel records.
Returns
Promise<HypeTrainStatus>
A status object. current is null outside an active train. If the streamer has not granted Twitch's Hype Train permission, available is false and reason is missing_twitch_scope.
Remarks
Cached for about 45 seconds server-side.
onBegin()
ts
onBegin(callback): void;Registers a callback fired when a Hype Train begins.
Parameters
callback
Returns
void
onEnd()
ts
onEnd(callback): void;Registers a callback fired when a Hype Train ends.
Parameters
callback
Returns
void
onProgress()
ts
onProgress(callback): void;Registers a callback fired as a Hype Train progresses.
Parameters
callback
Returns
void