twitchext
v1.0.2
Published
A drop-in wrapper around the Twitch Extension Helper.
Downloads
4
Maintainers
Readme
TwitchExt
A drop-in wrapper around the Twitch Extension Helper, except it fixes the outstanding issues:
- In the original
window.Twitch.ext
, you can only attach a single event listener for any given event. If both you and one of your libraries wanted to attach anonAuthorized
listener, one of them would be replaced by the other. With this newTwitchExt
, you can attach as many listeners as you want without worry. - In the original
window.Twitch.ext
, you couldn't use promises for asynchronous callbacks. With this newTwitchExt
, you may return a promise from your callback, and it'll wait accordingly.
Usage
This module completely mirrors the window.Twitch.ext
, and can be used as a drop-in replacement.
const TwitchExt = require("twitchext")
TwitchExt.onAuthorized(function(authorization) {
console.log("We are authorized!", authorization)
})
To Do
This assumes that the Twitch Extension Helper is accessible at window.Twitch.ext
. We should consider automatically injecting it if it isn't found. :]