<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [IdleTimer][1]
    *   [start][2]
        *   [Parameters][3]
    *   [reset][4]
    *   [stop][5]
    *   [dispatch][6]
    *   [subscribe][7]
        *   [Parameters][8]
    *   [unsubscribe][9]
        *   [Parameters][10]
*   [UserData][11]
    *   [read][12]
        *   [Parameters][13]
    *   [write][14]
        *   [Parameters][15]
    *   [delete][16]
        *   [Parameters][17]
*   [DateUtil][18]
    *   [isInSeason][19]
        *   [Parameters][20]
        *   [Examples][21]
*   [Point][22]
*   [Point][23]
*   [PositionCallback][24]
    *   [Parameters][25]
*   [Anchor][26]
    *   [onResize][27]
        *   [Parameters][28]
*   [ScaleCallback][29]
    *   [Parameters][30]
*   [SafeScaleManager][31]
    *   [Parameters][32]
    *   [entities][33]
    *   [resizeEventData][34]
    *   [removeEntity][35]
        *   [Parameters][36]
    *   [enable][37]
        *   [Parameters][38]
    *   [disable][39]
    *   [calcOffset][40]
        *   [Parameters][41]
    *   [addEntity][42]
        *   [Parameters][43]
*   [ResizeHelper][44]
    *   [Parameters][45]
    *   [iOS][46]
    *   [enabled][47]
    *   [enabled][48]
        *   [Parameters][49]
    *   [onWindowResize][50]
    *   [getWindowResolution][51]
*   [EntityResizeEvent][52]
*   [ScaledEntity][53]
    *   [onResize][54]
        *   [Parameters][55]
*   [ScaleManager][56]
    *   [Parameters][57]
    *   [Properties][58]
    *   [enable][59]
        *   [Parameters][60]
    *   [disable][61]
*   [SpeechSynth][62]
    *   [Parameters][63]
    *   [Properties][64]
    *   [pause][65]
    *   [resume][66]
    *   [cancel][67]
    *   [say][68]
        *   [Parameters][69]
    *   [setVoice][70]
        *   [Parameters][71]
    *   [getVoice][72]
    *   [rate][73]
        *   [Parameters][74]
    *   [rate][75]
    *   [pitch][76]
        *   [Parameters][77]
    *   [pitch][78]
    *   [volume][79]
        *   [Parameters][80]
    *   [volume][81]
*   [filterType][82]
*   [ColorFilter][83]
    *   [applyFilter][84]
        *   [Parameters][85]
    *   [changeFilter][86]
        *   [Parameters][87]
    *   [removeFilter][88]
    *   [types][89]
*   [KeyState][90]
    *   [Properties][91]
*   [Controller][92]
    *   [Parameters][93]
    *   [onWindowBlur][94]
    *   [update][95]
    *   [onKeyDown][96]
        *   [Parameters][97]
    *   [onKeyUp][98]
        *   [Parameters][99]
    *   [assignButtons][100]
        *   [Parameters][101]
*   [Key][102]
    *   [Parameters][103]
    *   [Properties][104]
    *   [updateState][105]
        *   [Parameters][106]
    *   [action][107]
    *   [state][108]
*   [Application][109]
    *   [Properties][110]
    *   [getPlugin][111]
        *   [Parameters][112]
    *   [validateListeners][113]
    *   [setStateDefaults][114]
    *   [setupPlugins][115]
    *   [\_plugins][116]
    *   [uses][117]
        *   [Parameters][118]
    *   [getPlugin][119]
        *   [Parameters][120]
*   [Debugger][121]
    *   [Parameters][122]
    *   [Properties][123]
    *   [params][124]
    *   [minLevel][125]
        *   [Parameters][126]
    *   [emit][127]
        *   [Parameters][128]
    *   [LEVEL][129]
    *   [log][130]
        *   [Parameters][131]
    *   [assert][132]
        *   [Parameters][133]
    *   [isEnabled][134]
    *   [enable][135]
        *   [Parameters][136]
    *   [paramKey][137]
*   [HintSequencePlayer][138]
    *   [play][139]
    *   [clear][140]
    *   [add][141]
        *   [Parameters][142]
    *   [remove][143]
        *   [Parameters][144]
*   [IHintPlayer][145]
    *   [Properties][146]
*   [Property][147]
    *   [Properties][148]
    *   [value][149]
    *   [value][150]
        *   [Parameters][151]
    *   [subscribe][152]
        *   [Parameters][153]
    *   [unsubscribe][154]
        *   [Parameters][155]
    *   [hasListeners][156]
*   [Caption][157]
    *   [Parameters][158]
    *   [update][159]
        *   [Parameters][160]
    *   [updateState][161]
        *   [Parameters][162]
    *   [isFinished][163]
    *   [start][164]
        *   [Parameters][165]
    *   [updateTimeIndex][166]
        *   [Parameters][167]
*   [Caption][168]
    *   [Properties][169]
    *   [update][170]
        *   [Parameters][171]
    *   [updateState][172]
        *   [Parameters][173]
    *   [isFinished][174]
    *   [start][175]
        *   [Parameters][176]
    *   [updateTimeIndex][177]
        *   [Parameters][178]
*   [CaptionFactory][179]
    *   [createCaptionMap][180]
        *   [Parameters][181]
    *   [createCaption][182]
        *   [Parameters][183]
    *   [createLine][184]
        *   [Parameters][185]
*   [CaptionPlayer][186]
    *   [Parameters][187]
    *   [update][188]
        *   [Parameters][189]
    *   [start][190]
        *   [Parameters][191]
    *   [stop][192]
*   [CaptionPlayer][193]
    *   [update][194]
        *   [Parameters][195]
    *   [start][196]
        *   [Parameters][197]
    *   [stop][198]
*   [TimedLine][199]
    *   [Properties][200]
    *   [setContent][201]
        *   [Parameters][202]
*   [IRender][203]
    *   [Properties][204]
*   [DOMRenderer][205]
    *   [Parameters][206]
    *   [start][207]
        *   [Parameters][208]
    *   [stop][209]
*   [HtmlRenderer][210]
    *   [lineBegin][211]
        *   [Parameters][212]
    *   [lineEnd][213]
*   [TemplateRenderer][214]
    *   [Parameters][215]
*   [TextRenderer][216]
    *   [lineBegin][217]
        *   [Parameters][218]
    *   [lineEnd][219]
    *   [sanitize][220]
        *   [Parameters][221]
*   [Localizer.Options][222]
*   [Localizer][223]
    *   [resolve][224]
        *   [Parameters][225]
    *   [setPrimaryLocale][226]
        *   [Parameters][227]
    *   [setFallbackLocale][228]
        *   [Parameters][229]
    *   [getLocaleKey][230]
        *   [Parameters][231]
    *   [getBrowserLanguages][232]
*   [ApplicationPlugin][233]
    *   [preload][234]
    *   [init][235]
    *   [start][236]

## IdleTimer

### start

#### Parameters

*   `time` **[Number][237]** time in milliseconds (optional, default `15000`)

Returns **void** @memberof IdleTimer

### reset

resets the timer, does not call subscribed functions

Returns **void** @memberof IdleTimer

### stop

Returns **void** @memberof IdleTimer

### dispatch

Calls all subscribed functions, and resets the timer.

Returns **void** @memberof IdleTimer

### subscribe

Adds a function to be called when timer is dispatched

#### Parameters

*   `callback` &#x20;

Returns **void** @memberof IdleTimer

### unsubscribe

Removes a function from being called when timer is dispatched

#### Parameters

*   `callback` **any**&#x20;

Returns **void** @memberof IdleTimer

## UserData

Manages data between SpringRoll Container and SpringRoll

### read

Gets data from SpringRoll Container

#### Parameters

*   `name` **[string][238]**&#x20;

Returns **[Promise][239]**&#x20;

### write

Sends data to SpringRoll Container

#### Parameters

*   `name` **[string][238]**&#x20;
*   `value` **any**&#x20;

Returns **[Promise][239]**&#x20;

### delete

Removes data from SpringRoll Container

#### Parameters

*   `name` **[string][238]**&#x20;

## DateUtil

Utility class for date-related operations.

### isInSeason

Checks if the current date falls within a provided date range.

#### Parameters

*   `startDate` **([string][238] | [Date][240])** The start date of the range (inclusive)
*   `endDate` **([string][238] | [Date][240])** The end date of the range (inclusive)

#### Examples

```javascript
// Check if current date is within Christmas season

import { DateUtil } from "springroll";

if (DateUtil.isInSeason('2024-12-01', '2024-12-31')) {
  showChristmasContent();
}
```

```javascript
// Using Date objects

import { DateUtil } from "springroll";

const summerStart = new Date(2024, 5, 21); // June 21, 2024
const summerEnd = new Date(2024, 8, 22);   // September 22, 2024
if (DateUtil.isInSeason(summerStart, summerEnd)) {
  showSummerContent();
}
```

Returns **[boolean][241]** True if current date is within the range, false otherwise

## Point

Type: {x: [Number][237], y: [Number][237]}

## Point

Type: {x: [Number][237], y: [Number][237]}

## PositionCallback

callback to used move game entities

Type: [Function][242]

### Parameters

*   `position` **[Point][22]** position relative to anchor direction

## Anchor

Used to fix positions to a relative point in the viewport.

### onResize

#### Parameters

*   `param` **[object][243]**&#x20;

    *   `param.viewArea` **[Point][22]**&#x20;

Returns **void** @memberof Anchor

## ScaleCallback

callback to used scale game and canvas

Type: [Function][242]

### Parameters

*   `width` **[Number][237]** width canvas should be
*   `height` **[Number][237]** height canvas should be
*   `scale` **[Point][22]** x/y scale values
*   `scaleRatio` **[Number][237]** minimum aspect ratio that fit's in the screen.
*   `viewArea` **[Object][243]** Rectangle defining the total viewable area of game content.

## SafeScaleManager

Handles scaling the game

### Parameters

*   `$0` **[Object][243]**&#x20;

    *   `$0.width` &#x20;
    *   `$0.height` &#x20;
    *   `$0.safeWidth`   (optional, default `Infinity`)
    *   `$0.safeHeight`   (optional, default `Infinity`)
    *   `$0.callback`   (optional, default `()=>{}`)
*   `param` **[object][243]**&#x20;

### entities

Type: [Array][244]<[ScaledEntity][53]>

### resizeEventData

Type: [EntityResizeEvent][52]

### removeEntity

Removes an anchor

#### Parameters

*   `entity` **[ScaledEntity][53]**&#x20;

Returns **void** @memberof SafeScaleManager

### enable

Enables the scale manager listener. Will not be enabled if a callback is not supplied.

#### Parameters

*   `callback` **[ScaleCallback][29]** The function to be called on resize events.

### disable

Disables the scale manager.

### calcOffset

Calculates the offset for anchors.

#### Parameters

*   `scale` **[Point][22]** scale value

Returns **[Point][22]**&#x20;

### addEntity

Adds and anchor to be updated during resize

#### Parameters

*   `entity` **([ScaledEntity][53] | [Array][244]<[ScaledEntity][53]>)**&#x20;

## ResizeHelper

Utility class that handles resize events for ScaleManager and SafeScaleManager.

### Parameters

*   `resizeCallback` **[function][242]**&#x20;

### iOS

Whether or not the application is running on an iOS device.

### enabled

Returns the enabled state of the ResizeHelper.

### enabled

Sets the enabled state of the ResizeHelper.
Forces a resize event.

#### Parameters

*   `value` &#x20;

### onWindowResize

Handler for window resize events. Forwards this event to the scale manager if enabled.

### getWindowResolution

Sets the window width and window height values of the ResizeHelper.

## EntityResizeEvent

Type: {offset: [Point][22], gameSize: [Point][22], scale: [Point][22]}

## ScaledEntity

### onResize

#### Parameters

*   `event` **[EntityResizeEvent][52]**&#x20;

Returns **void** @memberof ScaledEntity

## ScaleManager

\[Deprecated]

Simplifies listening to resize events by passing the relevant data to a provided callback.

### Parameters

*   `callback` **[Function][242]**  (optional, default `undefined`)

### Properties

*   `callback` **[Function][242]?**&#x20;

### enable

Enables the scale manager listener. Will not be enabled if a callback is not supplied.

#### Parameters

*   `callback` **[Function][242]** The function to be called on resize events.

### disable

Disables the scale manager.

## SpeechSynth

SpeechSync makes it easy to convert text to speech.
Note: This is not supported on IE11 and below because of the underlying APIs are not implemented in those browsers

### Parameters

*   `params` **[object][243]**&#x20;

    *   `params.voice` **[number][237]** Indicates what voice to use. (optional, default `0`)
    *   `params.rate` **[number][237]** The rate at which the text is said. Supports a range from 0.1 to 10. (optional, default `1`)
    *   `params.pitch` **[number][237]** Voice Pitch. Supports a pitch from 0 to 2. (optional, default `0`)
    *   `params.volume` **[number][237]** Volume. Supports 0 to 1. (optional, default `1`)

### Properties

*   `voicesLoaded` **[boolean][241]** voices are loaded async. This is will be set to true when they are loaded.

### pause

Pauses the announcer.

### resume

Resumes the announcer.

### cancel

Pauses the announcer and clears the queue.

### say

Causes the announcer to say whatever message is passed to it.
If the announcer is already saying something then it will be added to a queue.

#### Parameters

*   `message` **[string][238]**&#x20;

### setVoice

Sets the voice by array index.

#### Parameters

*   `index` **[number][237]**&#x20;

### getVoice

Returns the voice object.

Returns **([object][243] | null)**&#x20;

### rate

Rate at which text is spoken.

#### Parameters

*   `rate` **[number][237]**&#x20;

### rate

Returns rate which text is spoken.

Returns **[number][237]**&#x20;

### pitch

Sets the pitch at which text is spoken.

#### Parameters

*   `pitch` **[number][237]**&#x20;

### pitch

Returns the pitch at which text is spoken.

Returns **[number][237]**&#x20;

### volume

Sets the current volume of the announcer.

#### Parameters

*   `volume` **[number][237]**&#x20;

### volume

Returns the current volume of the announcer.

Returns **[number][237]**&#x20;

## filterType

Type: (`"protanopia"` | `"protanomaly"` | `"deuteranopia"` | `"deuteranomaly"` | `"tritanopia"` | `"tritanomaly"` | `"achromatopsia"` | `"achromatomaly"`)

## ColorFilter

The Color filter allows you to simulate colorblindness.

### applyFilter

Applies the specified filter to the element.

#### Parameters

*   `element` **[HTMLElement][245]**&#x20;
*   `type` **[filterType][82]**&#x20;

### changeFilter

Changes the currently applied filter to the element if the color filter has it.

#### Parameters

*   `type` **[filterType][82]**&#x20;

Returns **any**&#x20;

### removeFilter

Removes the filter from the element.

### types

Supported filter types.

Returns **[object][243]** Returns an object { name, value } with the colorblindness type:
(Protanopia, Protanomaly, Deuteranopia, Deuteranomaly, Tritanopia, Tritanomaly, Achromatopsia, Achromatomaly)

## KeyState

Type: (`0` | `1` | `2`)

### Properties

*   `down` **[Function][242]**&#x20;
*   `up` **[Function][242]**&#x20;
*   `key` **[string][238]**&#x20;

## Controller

Controller interface class to simplify working with key presses.

### Parameters

*   `buttons` **[Array][244]\<KeyTemplate>** An object containing all keys you want to watch and their functions. e.g. {enter: () => {}}. See [https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key\_Values][246] for potential values. (optional, default `[]`)

### onWindowBlur

Called on window blur, sets button state to up if button was down;

Returns **void** @memberof Controller

### update

Calls all functions for buttons that are currently set to enabled.

### onKeyDown

Called on keyup. Sets flag to 1 if key is being watched.

#### Parameters

*   `e` **[KeyboardEvent][247]**&#x20;

### onKeyUp

Called on keyup. Sets flag to 2 if key is being watched.

#### Parameters

*   `e` **[KeyboardEvent][247]**&#x20;

### assignButtons

Sets an object of button functions to the controller to be called.

#### Parameters

*   `keys` **[Array][244]\<KeyTemplate>**&#x20;

## Key

Represents a single key on the keyboard and the functions related to it.

### Parameters

*   `key` **[string][238]** What this object represents.
*   `down` **[Function][242]** Function to be called while the key is held down. (optional, default `()=>{}`)
*   `up` **[Function][242]** Function to be called when the key is lifted up. (optional, default `()=>{}`)

### Properties

*   `state` **(`0` | `1` | `2`)** The current state of the key. 0 = inactive, 1 = active, 2 = to be set to inactive.
*   `key` **[string][238]** The name of the key we are targeting.
*   `actions` **[object][243]**&#x20;

    *   `actions.down` **[function][242]** Function to be called while the key is held down.
    *   `actions.up` **[function][242]** Function to be called when the key is lifted up.

### updateState

Updates the internal state of the key. Accepts a range between 0-2. Will set key state to 0 if nothing is passed.

#### Parameters

*   `state` **(`0` | `1` | `2`)**  (optional, default `0`)

### action

Calls the relevant action for the current state of the key.

### state

Returns the current state of the key.

Returns **[number][237]**&#x20;

## Application

Main entry point for a game. Provides a single focal point for plugins and functionality to attach.

### Properties

*   `features` **[object][243]** A configuration object denoting which features are enabled for this application

    *   `features.captions` **[boolean][241]?** A boolean value denoting that this game supports captions
    *   `features.sound` **[boolean][241]?** A boolean value denoting that this game has some audio in it
    *   `features.vo` **[boolean][241]?** A boolean denoting that this game has mutable voice-over audio in it
    *   `features.music` **[boolean][241]?** A boolean denoting that this game has mutable music in it
    *   `features.sfx` **[boolean][241]?** A boolean denoting that this game has mutable sound effects in it
    *   `features.soundVolume` **[boolean][241]?** A boolean denoting that this game has adjustable sound volume in it
    *   `features.musicVolume` **[boolean][241]?** A boolean denoting that this game has adjustable music volume in it
    *   `features.voVolume` **[boolean][241]?** A boolean denoting that this game has adjustable voice-over volume in it
    *   `features.sfxVolume` **[boolean][241]?** A boolean denoting that this game has adjustable sound effects volume in it
    *   `features.pointerSize` **[boolean][241]?** A boolean denoting that this game has adjustable pointer size in it
    *   `features.controlSensitivity` **[boolean][241]?** A boolean denoting that this game has adjustable control sensitivity in it
    *   `features.buttonSize` **[boolean][241]?** A boolean denoting that this game has adjustable button sizes in it
    *   `features.removableLayers` **[boolean][241]?** A boolean denoting that this game has removable game layers in it
    *   `features.hudPosition` **[boolean][241]?** A boolean denoting that this game has custom HUD positions.
    *   `features.hitAreaScale` **[boolean][241]?** A boolean denoting that this game has adjustable hit areas.
    *   `features.dragThresholdScale` **[boolean][241]?** A boolean denoting that this game has adjustable drag thresholds.
    *   `features.health` **[boolean][241]?** A boolean denoting that this game has adjustable health.
    *   `features.objectCount` **[boolean][241]?** A boolean denoting that this game has adjustable object count requirements.
    *   `features.completionPercentage` **[boolean][241]?** A boolean denoting that this game has adjustable completion percentage requirements.
    *   `features.speedScale` **[boolean][241]?** A boolean denoting that this game has adjustable speed.
    *   `features.timersScale` **[boolean][241]?** A boolean denoting that this game has adjustable timers.
    *   `features.inputCount` **[boolean][241]?** A boolean denoting that this game has adjustable input count requirements.
    *   `features.keyBinding` **[boolean][241]?** A boolean denoting that this game has re-mappable key bindings.
    *   `features.colorVision` **[boolean][241]?** A boolean denoting that this game has color blindess filters
    *   `features.fullScreen` **[boolean][241]?** A boolean denoting that this game has fullScreen capabilities

### getPlugin

returns instance of a plugin.

#### Parameters

*   `name` **[string][238]**&#x20;

Returns **(SpringRoll.ApplicationPlugin | [undefined][248])**&#x20;

### validateListeners

Validates that appropriate listeners are added for the features that were enabled in the constructor

*   Throws **any** Error

### setStateDefaults

Sets default values of application state properties.

### setupPlugins

preloads, initializes and starts plugins.

Returns **[Promise][239]\<void>**&#x20;

### \_plugins

The list of plugins that are currently registered to run on Applications.

### uses

Registers a plugin to be used by applications, sorting it by priority order.

#### Parameters

*   `plugin` **SpringRoll.ApplicationPlugin** The plugin to register.

### getPlugin

Finds a plugin by name.

#### Parameters

*   `name` **[string][238]** The name of the plugin.

Returns **(SpringRoll.ApplicationPlugin | [undefined][248])**&#x20;

## Debugger

Type: [object][243]

### Parameters

*   `params` **[Object][243]** Options

    *   `params.emitEnabled` **[boolean][241]** If this should emit events to the window. (optional, default `false`)
    *   `params.minLevel` **(`"GENERAL"` | `"DEBUG"` | `"INFO"` | `"WARN"` | `"ERROR"`)** The starting log level for the logger. (optional, default `'GENERAL'`)

### Properties

*   `emitEnabled` **[boolean][241]**&#x20;
*   `enabled` **[boolean][241]**&#x20;
*   `minLevel` **[number][237]**&#x20;

### params

Returns the params of the debugger.

Returns **DebuggerParams**&#x20;

### minLevel

Sets the logging level of the debugger.

#### Parameters

*   `level` **([string][238] | [number][237])** The name of the level.

Returns **void**&#x20;

### emit

If emitting is enabled for this instance, then it will dispatch an event on the window.

#### Parameters

*   `eventName` **[string][238]** Name of the event (optional, default `'Debugger'`)

### LEVEL

Returns logging levels.

Returns **[object][243]**&#x20;

### log

Console logs all supplied arguments if the log level is low enough for them to be logged.

#### Parameters

*   `type` **(`"log"` | `"general"` | `"warn"` | `"error"` | `"debug"` | `"info"`)** minimum level for this log to run at (optional, default `'log'`)
*   `args` **[Array][244]\<any>** Arguments you wish to log.

### assert

Will throw if statement is false.

#### Parameters

*   `isTrue` **[boolean][241]** The expression to evaluate.

### isEnabled

Returns a boolean indicating if the debugger has been enabled or not.

Returns **[boolean][241]**&#x20;

### enable

Disables or enables all debugger instances.
TODO: Remove the parameter here, and add a disable method as well

#### Parameters

*   `flag` **[boolean][241]**&#x20;

Returns **void**&#x20;

### paramKey

Returns the global params key.

## HintSequencePlayer

### play

invokes the next hint

Returns **void** @memberof HintSequencePlayer

### clear

removes all hints

Returns **void** @memberof HintSequencePlayer

### add

#### Parameters

*   `callbacks` **[Array][244]\<function ()>**&#x20;

Returns **void** @memberof HintSequencePlayer

### remove

#### Parameters

*   `callbacks` **[Array][244]\<function ()>**&#x20;

Returns **void** @memberof HintSequencePlayer

## IHintPlayer

Hint Player interface to help enforce minimum requirements for hint players

### Properties

*   `play` **[function][242]** called by application to

## Property

A class for representing changeable/subscribable properties.

### Properties

*   `_value` **any** the value of the property
*   `listeners` **\[]** all the objects listening to this property
*   `alwaysNotify` **[boolean][241]** Determines if the property will notify a value change regardless if it's a new value or not.

### value

The current value of the property

Type: any

### value

Setting this value notifies all listeners of the change.

Type: any

#### Parameters

*   `value` &#x20;

### subscribe

Adds a subscriber to this property.

#### Parameters

*   `callback` **[function][242]** The callback to call whenever the property changes.

### unsubscribe

Unsubscribes a listener from this property.

#### Parameters

*   `callback` **[function][242]** The callback to unsubscribe.

### hasListeners

Whether or not this property has any subscribed listeners

Type: [Boolean][241]

## Caption

### Parameters

*   `lines` &#x20;

### update

Updates content based on time passed.
This should be called every frame that the caption is active.

#### Parameters

*   `deltaTime` **[Number][237]** Time in seconds since last frame.

### updateState

Handles calling callbacks and updating caption's current state.

#### Parameters

*   `currentTime` **[Number][237]**&#x20;
*   `lastTime` **[Number][237]**&#x20;

### isFinished

Checks if caption has completed.

Returns **[Boolean][241]**&#x20;

### start

Sets time and line index of caption.

#### Parameters

*   `time` **[Number][237]** Time in milliseconds. (optional, default `0`)
*   `renderer`   (optional, default `{lineBegin:()=>{},lineEnd:()=>{}}`)

### updateTimeIndex

Updates the current time and index of the caption instance

#### Parameters

*   `time` **[Number][237]**  (optional, default `0`)

## Caption

### Properties

*   `lines` **[Array][244]<[TimedLine][199]>**&#x20;
*   `time` **[number][237]**&#x20;
*   `lineIndex` **[number][237]**&#x20;
*   `renderer` **[IRender][203]**&#x20;

### update

Updates content based on time passed.
This should be called every frame that the caption is active.

#### Parameters

*   `deltaTime` **[Number][237]** Time in seconds since last frame.

### updateState

Handles calling callbacks and updating caption's current state.

#### Parameters

*   `currentTime` **[Number][237]**&#x20;
*   `lastTime` **[Number][237]**&#x20;

### isFinished

Checks if caption has completed.

Returns **[Boolean][241]**&#x20;

### start

Sets time and line index of caption.

#### Parameters

*   `time` **[Number][237]** Time in milliseconds. (optional, default `0`)
*   `renderer`   (optional, default `{lineBegin:()=>{},lineEnd:()=>{}}`)

### updateTimeIndex

Updates the current time and index of the caption instance

#### Parameters

*   `time` **[Number][237]**  (optional, default `0`)

## CaptionFactory

Collection of functions for creating Captions

### createCaptionMap

Creates a new Object\<String, Caption>.

#### Parameters

*   `data` **[JSON][249]**&#x20;

Returns **[Object][243]**&#x20;

### createCaption

Creates a new Caption from JSON data.

#### Parameters

*   `captionData` **any**&#x20;

Returns **[Caption][157]** new Caption

### createLine

Creates a new TimedLine from JSON data.

#### Parameters

*   `lineData` **any**&#x20;

Returns **[TimedLine][199]** new TimedLine;

## CaptionPlayer

### Parameters

*   `captions` &#x20;
*   `renderer` &#x20;

### update

Updates any currently playing caption.
This should be called every frame.

#### Parameters

*   `deltaTime` **[Number][237]** Time passed in seconds since last update call.

### start

Starts playing a caption.

#### Parameters

*   `name` **[String][238]** Name of caption.
*   `time` **[number][237]** Atart time in milliseconds. (optional, default `0`)
*   `args` **[object][243]** Arguments that will get passed to the renderer (optional, default `{}`)

### stop

Stops any caption currently playing.

## CaptionPlayer

CaptionPlayer is used to start, stop and update captions.
It applies the content of an active caption to a given CaptionRenderer.

### update

Updates any currently playing caption.
This should be called every frame.

#### Parameters

*   `deltaTime` **[Number][237]** Time passed in seconds since last update call.

### start

Starts playing a caption.

#### Parameters

*   `name` **[String][238]** Name of caption.
*   `time` **[number][237]** Atart time in milliseconds. (optional, default `0`)
*   `args` **[object][243]** Arguments that will get passed to the renderer (optional, default `{}`)

### stop

Stops any caption currently playing.

## TimedLine

### Properties

*   `startTime` **[number][237]**&#x20;
*   `endTime` **[number][237]**&#x20;
*   `content` **[string][238]**&#x20;

### setContent

Sets line's content. Removes HTML formatting for text.

#### Parameters

*   `content` **any**&#x20;

Returns **void** @memberof TimedLine

## IRender

Render interface to help enforce minimum requirements for caption renderers

### Properties

*   `start` **[function][242]** called when the Caption Player starts playing captions
*   `stop` **[function][242]** called when the Caption Player stops playing captions
*   `lineBegin` **[function][242]** called when rendering a new line of text
*   `lineEnd` **[function][242]** called when finished rendering a new of text

## DOMRenderer

DOMRender is a incomplete renderer that is intended to supply just the basic start and stop functions

### Parameters

*   `element` **[HTMLElement][245]**&#x20;
*   `templateVariables` **[Object][243]**&#x20;

### start

Makes target element visible and ready to present captions

#### Parameters

*   `templateVariables` **[object][243]** Variables that can used during caption play time (optional, default `{}`)

### stop

H

## HtmlRenderer

HTML Renderer is intended for rendering raw html in the use case of wanting to display styled captions

### lineBegin

Called by Caption Player when a new line needs to be displayed

#### Parameters

*   `line` &#x20;

### lineEnd

Called by Caption Player when a line is complete

## TemplateRenderer

TemplateRenderer accepts a string template e.g.`The ball is {{color}}` and a args object e.g. `{color: 'red'}`
and swaps out the placeholder inside the double brackets with the matching key inside the args object

### Parameters

*   `template` **[string][238]** String template that will be rendered with the supplied arguments
*   `args` **[Object][243]** //An Object contain data to be inserted into the template This will match based on key values

Returns **[string][238]**&#x20;

## TextRenderer

TextRenderer is intended for just rendering test. It will attempt to sanitize any strings passed to it by removing html syntax

### lineBegin

Called by Caption Player when a new line needs to be displayed

#### Parameters

*   `line` &#x20;

### lineEnd

Called by Caption Player when a line is complete

### sanitize

Will attempt to remove all html from a string before it's renderer to the page

#### Parameters

*   `html` **any**&#x20;

## Localizer.Options

Type: {language: [string][238], fallback: [string][238]}

## Localizer

### resolve

#### Parameters

*   `path` **[string][238]**&#x20;
*   `options` **any**  (optional, default `{}`)

Returns **{path: [string][238], language: [string][238]}**&#x20;

### setPrimaryLocale

#### Parameters

*   `localeKey` **[string][238]**&#x20;

Returns **[boolean][241]** True if language is set.

### setFallbackLocale

#### Parameters

*   `localeKey` **[string][238]**&#x20;

Returns **[boolean][241]** True if fallback is set.

### getLocaleKey

#### Parameters

*   `localeKey` **[string][238]**&#x20;

Returns **[string][238]**&#x20;

### getBrowserLanguages

## ApplicationPlugin

Represents a single plugin for applications. Allows developers to inject code in the start up process of an
application providing new features to the application.

### preload

A preload method for the plugin which allows for asynchronous setup tasks. Either takes a callback as first
parameter, or should return a Promise indicating that loading is finished.

Returns **[Promise][239]** A promise indicating when the plugin is finished loading.

### init

An init method for the plugin. This method is ran synchronously in the constructor of the Application.
After all plugins preloads  has completed

### start

A start method for the plugin. This method is ran synchronously in the constructor of the Application.
After all plugins inits has completed

[1]: #idletimer

[2]: #start

[3]: #parameters

[4]: #reset

[5]: #stop

[6]: #dispatch

[7]: #subscribe

[8]: #parameters-1

[9]: #unsubscribe

[10]: #parameters-2

[11]: #userdata

[12]: #read

[13]: #parameters-3

[14]: #write

[15]: #parameters-4

[16]: #delete

[17]: #parameters-5

[18]: #dateutil

[19]: #isinseason

[20]: #parameters-6

[21]: #examples

[22]: #point

[23]: #point-1

[24]: #positioncallback

[25]: #parameters-7

[26]: #anchor

[27]: #onresize

[28]: #parameters-8

[29]: #scalecallback

[30]: #parameters-9

[31]: #safescalemanager

[32]: #parameters-10

[33]: #entities

[34]: #resizeeventdata

[35]: #removeentity

[36]: #parameters-11

[37]: #enable

[38]: #parameters-12

[39]: #disable

[40]: #calcoffset

[41]: #parameters-13

[42]: #addentity

[43]: #parameters-14

[44]: #resizehelper

[45]: #parameters-15

[46]: #ios

[47]: #enabled

[48]: #enabled-1

[49]: #parameters-16

[50]: #onwindowresize

[51]: #getwindowresolution

[52]: #entityresizeevent

[53]: #scaledentity

[54]: #onresize-1

[55]: #parameters-17

[56]: #scalemanager

[57]: #parameters-18

[58]: #properties

[59]: #enable-1

[60]: #parameters-19

[61]: #disable-1

[62]: #speechsynth

[63]: #parameters-20

[64]: #properties-1

[65]: #pause

[66]: #resume

[67]: #cancel

[68]: #say

[69]: #parameters-21

[70]: #setvoice

[71]: #parameters-22

[72]: #getvoice

[73]: #rate

[74]: #parameters-23

[75]: #rate-1

[76]: #pitch

[77]: #parameters-24

[78]: #pitch-1

[79]: #volume

[80]: #parameters-25

[81]: #volume-1

[82]: #filtertype

[83]: #colorfilter

[84]: #applyfilter

[85]: #parameters-26

[86]: #changefilter

[87]: #parameters-27

[88]: #removefilter

[89]: #types

[90]: #keystate

[91]: #properties-2

[92]: #controller

[93]: #parameters-28

[94]: #onwindowblur

[95]: #update

[96]: #onkeydown

[97]: #parameters-29

[98]: #onkeyup

[99]: #parameters-30

[100]: #assignbuttons

[101]: #parameters-31

[102]: #key

[103]: #parameters-32

[104]: #properties-3

[105]: #updatestate

[106]: #parameters-33

[107]: #action

[108]: #state

[109]: #application

[110]: #properties-4

[111]: #getplugin

[112]: #parameters-34

[113]: #validatelisteners

[114]: #setstatedefaults

[115]: #setupplugins

[116]: #_plugins

[117]: #uses

[118]: #parameters-35

[119]: #getplugin-1

[120]: #parameters-36

[121]: #debugger

[122]: #parameters-37

[123]: #properties-5

[124]: #params

[125]: #minlevel

[126]: #parameters-38

[127]: #emit

[128]: #parameters-39

[129]: #level

[130]: #log

[131]: #parameters-40

[132]: #assert

[133]: #parameters-41

[134]: #isenabled

[135]: #enable-2

[136]: #parameters-42

[137]: #paramkey

[138]: #hintsequenceplayer

[139]: #play

[140]: #clear

[141]: #add

[142]: #parameters-43

[143]: #remove

[144]: #parameters-44

[145]: #ihintplayer

[146]: #properties-6

[147]: #property

[148]: #properties-7

[149]: #value

[150]: #value-1

[151]: #parameters-45

[152]: #subscribe-1

[153]: #parameters-46

[154]: #unsubscribe-1

[155]: #parameters-47

[156]: #haslisteners

[157]: #caption

[158]: #parameters-48

[159]: #update-1

[160]: #parameters-49

[161]: #updatestate-1

[162]: #parameters-50

[163]: #isfinished

[164]: #start-1

[165]: #parameters-51

[166]: #updatetimeindex

[167]: #parameters-52

[168]: #caption-1

[169]: #properties-8

[170]: #update-2

[171]: #parameters-53

[172]: #updatestate-2

[173]: #parameters-54

[174]: #isfinished-1

[175]: #start-2

[176]: #parameters-55

[177]: #updatetimeindex-1

[178]: #parameters-56

[179]: #captionfactory

[180]: #createcaptionmap

[181]: #parameters-57

[182]: #createcaption

[183]: #parameters-58

[184]: #createline

[185]: #parameters-59

[186]: #captionplayer

[187]: #parameters-60

[188]: #update-3

[189]: #parameters-61

[190]: #start-3

[191]: #parameters-62

[192]: #stop-1

[193]: #captionplayer-1

[194]: #update-4

[195]: #parameters-63

[196]: #start-4

[197]: #parameters-64

[198]: #stop-2

[199]: #timedline

[200]: #properties-9

[201]: #setcontent

[202]: #parameters-65

[203]: #irender

[204]: #properties-10

[205]: #domrenderer

[206]: #parameters-66

[207]: #start-5

[208]: #parameters-67

[209]: #stop-3

[210]: #htmlrenderer

[211]: #linebegin

[212]: #parameters-68

[213]: #lineend

[214]: #templaterenderer

[215]: #parameters-69

[216]: #textrenderer

[217]: #linebegin-1

[218]: #parameters-70

[219]: #lineend-1

[220]: #sanitize

[221]: #parameters-71

[222]: #localizeroptions

[223]: #localizer

[224]: #resolve

[225]: #parameters-72

[226]: #setprimarylocale

[227]: #parameters-73

[228]: #setfallbacklocale

[229]: #parameters-74

[230]: #getlocalekey

[231]: #parameters-75

[232]: #getbrowserlanguages

[233]: #applicationplugin

[234]: #preload

[235]: #init

[236]: #start-6

[237]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[238]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[239]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise

[240]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date

[241]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[242]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function

[243]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[244]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[245]: https://developer.mozilla.org/docs/Web/HTML/Element

[246]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values

[247]: https://developer.mozilla.org/docs/Web/API/KeyboardEvent

[248]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined

[249]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON
