Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Remote

The Remote class is a singleton class that provides the ability to store and retrieve Variables on a remote controller. It also provides listeners for Variable updates done remotely.

class

Hierarchy

  • Remote

Index

Properties

Private _enabled

_enabled: boolean

Private _initialized

_initialized: boolean = false

Private _remoteId

_remoteId: string

Private _throttledSaveVariable

_throttledSaveVariable: any

Throttles network save calls.

static
type

{any}

Static Private _sharedInstance

_sharedInstance: Remote = new Remote()

Initializes a new instance of Remote.

static
returns

A new instance of Remote.

Accessors

initialized

  • get initialized(): boolean
  • Returns whether the remote has been initialized with Firebase credentials.

    readonly

    Returns boolean

    Returns true if has Firebase credentials.

isEnabled

  • get isEnabled(): boolean
  • Whether the remote controller is enabled.

    static
    readonly

    Returns boolean

remoteId

  • get remoteId(): string
  • Returns the remote controller ID.

    readonly

    Returns string

    The remote controller ID.

remoteUrl

  • get remoteUrl(): string
  • Returns the remote controller URL.

    Example URL: "https://.firebaseapp.com/"

    readonly

    Returns string

    The remote controller URL.

Static attachedInstance

  • get attachedInstance(): Remote
  • Provides ability for Remixer HTML iFrame to access this instance of Remote.

    Returns Remote

    The attached instance of Remote.

Methods

Private _save

  • Performs the saving of the variable.

    When saving to remote, we first stop observing updates then restart after the update. This prevents a cyclical error of network and local changes.

    Parameters

    • variable: Variable

      The variable to save.

    Returns void

Private dbReference

  • dbReference(): Reference
  • Returns a database reference to the remixer instance.

    Returns Reference

    The firebase database reference.

Private generateRemoteId

  • generateRemoteId(): string
  • Generates a unique id consisting of 8 chars.

    Returns string

    Returns the new remote id.

Private getPreference

  • getPreference(key: string): any
  • Retrieves a preference from local storage.

    Parameters

    • key: string

      The key of the preference to retrieve.

    Returns any

    Returns the preference object.

Private savePreference

  • savePreference(key: string, value: any): void
  • Saves a preference to local storage.

    Parameters

    • key: string

      The preference key.

    • value: any

      The preference value.

    Returns void

Private startObservingUpdates

  • startObservingUpdates(variableKey: string): void
  • Starts a listener for any changes received for a variable.

    Parameters

    • variableKey: string

      The variable key.

    Returns void

startSharing

  • startSharing(): void
  • Start sharing the variable updates to the remote controller.

    Returns void

Private stopObservingUpdates

  • stopObservingUpdates(variableKey?: string): void
  • Stops all change listeners for a variable.

    Parameters

    • Optional variableKey: string

      The optional variable key.

    Returns void

stopSharing

  • stopSharing(): void
  • Stops sharing the variable updates to the remote controller.

    Returns void

Static initializeRemote

  • initializeRemote(config: __type): void
  • Initializes the remote controller.

    A call to this method will allow you to share your Variables to the remote controller being hosted as per your firebase configuration.

    static

    Parameters

    • config: __type

      The firebase credentials.

    Returns void

Static removeAllVariables

  • removeAllVariables(): void

Static saveVariable

  • saveVariable(variable: Variable, throttle?: boolean): void
  • Saves a variable remotely.

    A control's UI allows very fast updating of the selected value. For example the quick dragging of a slider, or keyboard input of a textbox. These selected value updates should be throttled since we only care about the final selected value and not intermittent changes.

    However adding a new Variable with params should not be throttled in order to capture many Variables be adding in quick succession.

    Defaults to throttle for saves to prevent network jank.

    static

    Parameters

    • variable: Variable

      The variable to save.

    • Default value throttle: boolean = true

    Returns void

Generated using TypeDoc