Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Muxy

The main extension entry interface, available as the global Muxy object.

This class handles environment detection, data harness collection and updates (for authentication and backend communication) and SDK instance creation.

On import or inclusion in an HTML file, a singleton object will be globally accessible as Muxy.

Hierarchy

  • Muxy

Index

Properties

DebuggingOptions

DebuggingOptions: DebuggingOptions

SDK

SDK: SDK = SDK

Returns a version of the Muxy SDK associated with the provided identifier.

since

1.0.0

param

A unique identifier for this extension or app. If omitted, the extension client id will be used.

throws

{Error} Will throw an error if called before Muxy.setup.

returns

An instance of the SDK class.

example

const sdk = new Muxy.SDK(); sdk.loaded().then(() => { sdk.send('Hello World'); }).catch((err) => { console.error(err); });

TriviaQuestionState

TriviaQuestionState: TriviaQuestionState = TriviaQuestionState

Makes trivia state enum available from the global Muxy object

debugOptions

debugOptions: DebugOptions

Debugging options. Should only be set by a call to .debug()

internal
type

{object}

loadReject

loadReject: function

Type declaration

    • (err: string): void
    • Parameters

      • err: string

      Returns void

loadResolve

loadResolve: function

Type declaration

    • (): void
    • Returns void

setupCalled

setupCalled: boolean

A flag used to signal when setup has been called. This function must be called once and only once before SDK objects may be created.

type

{boolean}

testChannelID

testChannelID: string

The Twitch Channel ID to use for testing. This will determine who the viewer and/or broadcaster appears as when testing the extension.

Changes to this value must be made before calling SDK.

type

{string}

testJWTRole

testJWTRole: string

Role for the current user in the sandbox environment. May be one of User.Roles.

Changes to this value must be made before calling SDK.

type

{string}

twitchClientID

twitchClientID: string

The Twitch ClientID as returned from the auth callback. This is used for all requests to Twitch's API.

readonly
type

{string}

Methods

TwitchClient

  • TwitchClient(): void
  • Returns a twitch client to use. Can only be used after the loaded promise resolves.

    since

    1.0.0

    throws

    {Error} Will throw an error if called before Muxy.setup.

    Returns void

    An instance of the TwitchClient class.

debug

  • Setup debugging options for the application. This allows the application to fake what user they are running as, the channel the extension is running on, pubsub debug message frequency, and even the backend URL that the extension uses.

    This should be called before setup().

    Parameters

    Returns void

setup

  • setup(options: any): void
  • Mandatory SDK setup call. Must be called once and only once to establish the Extension environment and client ID to use.

    since

    1.0.0

    since

    1.0.4

    since

    1.0.0

    since

    1.0.3

    throws

    {Error} Will throw an error if setup() has already been called, or if no Extension Client ID is provided.

    example

    Muxy.setup({ clientID: });

    Parameters

    • options: any

    Returns void

Static printInfo

  • printInfo(): void
  • Prints to console a description of the library's current version and environment info. This is called automatically when the library is setup, unless the quiet parameter is passed to setup.

    since

    1.0.0

    example

    Muxy.printInfo(); ┌──────────────────────────────────────────────────┐ | Muxy Extensions SDK | | v1.0.0 © 2017 Muxy, Inc. | | https://github.com/muxy/extensions-js | | | | Running in sandbox environment outside of Twitch | └──────────────────────────────────────────────────┘

    Returns void

Generated using TypeDoc