twitchext

A drop-in wrapper around the Twitch Extension Helper.

Usage no npm install needed!

<script type="module">
  import twitchext from 'https://cdn.skypack.dev/twitchext';
</script>

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 an onAuthorized listener, one of them would be replaced by the other. With this new TwitchExt, 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 new TwitchExt, 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. :]