Methods
# debugEvents()
Enables debug mode and logs event objects to the console
- Since:
- 1.0.2
# disableSenderCorrection()
Disables the sender correction for emulated events. Only useful for specific test-cases.
You can call this via window.Events.disableSenderCorrection()
- Since:
- 1.0.0
# expectsEventListener(listener) → {boolean}
Returns whether the window expects an event for the specified listener.
Name | Type | Description |
---|---|---|
listener |
string | The event-listener to check for. |
- Since:
- 1.0.0
- Type
- boolean
# expectsEventName(name) → {boolean}
Returns whether the window expects an event for the specified name.
Name | Type | Description |
---|---|---|
name |
string | The event-name to check for. |
- Since:
- 1.0.0
- Type
- boolean
# expectsEvents() → {boolean}
Returns whether the window expects any onEventReceived
events.
- Since:
- 1.0.0
- Type
- boolean
# isSkippable(event) → {boolean}
Returns whether the given event would not get queued by the StreamElements API.
Name | Type | Description |
---|---|---|
event |
string | The event-name to check for. |
- Since:
- 1.0.0
- Type
- boolean
# onBotCounterHandler(e)
Calls window.onBotCounter and gets triggered everytime a bot-counter gets updated. (Through chat commands for example)
Name | Type | Description |
---|---|---|
e |
BotCounterEvent | The event data object |
- Since:
- 1.0.0
# onCheerHandler(e)
Calls window.onCheer and gets triggered when someone cheers (uses Bits) in your channel.
Name | Type | Description |
---|---|---|
e |
CheerEvent | The event data object |
- Since:
- 1.0.0
# onCommunityGiftHandler(e)
Calls window.onCommunityGift and gets triggered for each gifted sub in a SubBomb. Has the same data as onSubGift and a fixed recipient.
Name | Type | Description |
---|---|---|
e |
CommunityGiftEvent | The event data object |
- Since:
- 1.0.0
# onDeleteMessageHandler(e)
Calls window.onDeleteMessage and gets triggered everytime a single message is deleted in your chat, by a moderator. You can use the passed messageId to delete the message in your own chat widget.
Name | Type | Description |
---|---|---|
e |
DeleteMessageEvent | The event data object |
- Since:
- 1.0.0
# onDeleteMessagesHandler(e)
Calls window.onMessage and gets triggered everytime multiple messages are deleted in your chat, by a moderator. This could occur on timeouts and bans and affects every message the user sent in chat this session. You can use the passed userId to delete all messages of that user in your own chat widget.
Name | Type | Description |
---|---|---|
e |
DeleteMessagesEvent | The event data object |
- Since:
- 1.0.0
# onEventReceivedHandler(p)
Handles the 'onEventReceived' event and forwards the data parameter to the corresponding handler. This function auto-determines which handler should be called, based on the provided data object.
Name | Type | Description |
---|---|---|
p |
object | The proxied obj parameter of the original onEventReceived event |
- Since:
- 1.0.0
# onEventSkipHandler()
Calls window.onEventSkip and gets triggered everytime you try to skip an alert in your dashboard.
- Since:
- 1.0.0
# onFollowHandler(e)
Calls window.onFollow and gets triggered when someone follows your channel.
Name | Type | Description |
---|---|---|
e |
FollowEvent | The event data object |
- Since:
- 1.0.0
# onKVStoreUpdateHandler(e)
Calls window.onKVStoreUpdate and gets triggered everytime a value changes. NOTE: This will also get triggered across widgets to communicate between them.
Name | Type | Description |
---|---|---|
e |
KVStoreUpdateEvent | The event data object |
- Since:
- 1.0.0
# onMessageHandler(e)
Calls window.onMessage and gets triggered everytime someone sends a message in your chat. If the message originates from Twitch chat, it will get transformed to a {@see ChatMessage} object.
Name | Type | Description |
---|---|---|
e |
MessageEvent | The event data object |
- Since:
- 1.0.0
# onRaidHandler(e)
Calls window.onCheer and gets triggered when someone raids your channel.
Name | Type | Description |
---|---|---|
e |
RaidEvent | The event data object |
- Since:
- 1.0.0
# onResubHandler(e)
Calls window.onResub and gets triggered when someone resubscribes on your channel.
Name | Type | Description |
---|---|---|
e |
ResubEvent | The event data object |
- Since:
- 1.0.0
# onSessionUpdateHandler(p)
Handles and forwards the 'onSessionUpdate' event data to window.onSessionUpdate.
Name | Type | Description |
---|---|---|
p |
object | The proxied obj parameter of the original onSessionUpdate event |
- Since:
- 1.0.0
# onSubBombCompleteHandler(e, recipients)
Calls window.onSubBombComplete and gets triggered after a SubBomb completes and all recipients are known. Passes an array of recipient names as second parameter.
Name | Type | Description |
---|---|---|
e |
SubBombEvent | The event data object |
recipients |
Array.<string> | An array of recipient names |
- Since:
- 1.0.0
# onSubBombHandler(e)
Calls window.onSubBomb and gets triggered when a SubBomb occurs. This event will trigger on the initial SubBomb message and only contains the sender and amount. Recipients are not known yet.
Name | Type | Description |
---|---|---|
e |
SubBombEvent | The event data object |
- Since:
- 1.0.0
# onSubGiftHandler(e)
Calls window.onSubGift and gets triggered when someone gifts a subscription to another user (targeted).
Name | Type | Description |
---|---|---|
e |
SubGiftEvent | The event data object |
- Since:
- 1.0.0
# onSubscriberHandler(e)
Calls window.onSubscriber and gets triggered when someone subscribes for the first time (first month) on your channel.
Name | Type | Description |
---|---|---|
e |
SubscriberEvent | The event data object |
- Since:
- 1.0.0
# onTipHandler(e)
Calls window.onTip and gets triggered when you receive a tip through StreamElements.
Name | Type | Description |
---|---|---|
e |
TipEvent | The event data object |
- Since:
- 1.0.0
# onToggleSoundHandler(e)
Calls window.onToggleSound and gets triggered everytime the user toggles the sound for alerts.
Name | Type | Description |
---|---|---|
e |
ToggleSoundEvent | The event data object |
- Since:
- 1.0.0
# onWidgetButtonHandler(e)
Calls window.onWidgetButton and gets triggered everytime you press a custom button (defined in your fields) via the overlay editor.
Name | Type | Description |
---|---|---|
e |
WidgetButtonEvent | The event data object |
- Since:
- 1.0.0
# onWidgetLoadHandler(p)
Handles and forwards the 'onWidgetLoad' event-data to window.onWidgetLoad.
Name | Type | Description |
---|---|---|
p |
object | The proxied obj parameter of the original onWidgetLoad event |
- Since:
- 1.0.0
# preflightEventListeners()
Checks which listener-functions are set on the window and adds them to the corresponding expectedEvents array.
- Since:
- 1.0.0
# registerOnEventReceived()
Registers the onEventReceived
listener, if any event is expected.
- Since:
- 1.0.0
# registerOnSessionUpdate()
Registers the onSessionUpdate listener, if the onSessionUpdate function was set on the window.
- Since:
- 1.0.0
# registerOnWidgetLoad()
Registers the onWidgetLoad
listener, if the onWidgetLoad
function was set on the window.
- Since:
- 1.0.0
# unregisterOnEventReceived()
Unregisters the onEventReceived
listener.
- Since:
- 1.0.0
# unregisterOnSessionUpdate()
Unregisters the onSessionUpdate
listener.
- Since:
- 1.0.0
# unregisterOnWidgetLoad()
Unregisters the onEventReceived listener.
- Since:
- 1.0.0
Type Definitions
# BotCounterEvent
- object
Properties
Name | Type | Description |
---|---|---|
counter |
string | |
value |
number |
# CheerEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
message |
string | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# CommunityGiftEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
count |
number | |
tier |
string | |
message |
string | |
sender |
string | |
gifted |
boolean | |
isCommunityGift |
boolean | |
playedAsCommunityGift |
boolean | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# DeleteMessageEvent
- object
Properties
Name | Type | Description |
---|---|---|
msgId |
string |
# DeleteMessagesEvent
- object
Properties
Name | Type | Description |
---|---|---|
userId |
string |
# FollowEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# KVStoreUpdateEvent
- object
Properties
Name | Type | Description |
---|---|---|
key |
string | |
value |
object |
# MessageEvent
- object
Properties
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
service |
string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
renderedText |
string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data |
object |
Properties
|
# RaidEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# ResubEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
tier |
string | |
message |
string | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# SubBombEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
count |
number | |
tier |
string | |
message |
string | |
sender |
string | |
bulkGifted |
boolean | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# SubGiftEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
tier |
string | |
message |
string | |
sender |
string | |
gifted |
boolean | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# SubscriberEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
tier |
string | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# TipEvent
- object
Properties
Name | Type | Description |
---|---|---|
_id |
string | |
name |
string | |
amount |
number | |
message |
string | |
sessionTop |
boolean | |
type |
string | |
originalEventName |
string |
# ToggleSoundEvent
- object
Properties
Name | Type | Description |
---|---|---|
muted |
boolean |
# WidgetButtonEvent
- object
Properties
Name | Type | Description |
---|---|---|
listener |
string | |
field |
string | |
value |
string |