springroll.Container Class

Extends springroll.EventDispatcher
Module: Container

The application container

Constructor

springroll.Container

(
  • iframeSelector
  • [options]
)

Parameters:

  • iframeSelector String

    jQuery selector for application iframe container

  • [options] Object optional

    Optional parameteres

    • [helpButton] String optional

      jQuery selector for help button

    • [captionsButton] String optional

      jQuery selector for captions button

    • [soundButton] String optional

      jQuery selector for captions button

    • [voButton] String optional

      jQuery selector for vo button

    • [sfxButton] String optional

      jQuery selector for sounf effects button

    • [musicButton] String optional

      jQuery selector for music button

    • [pauseButton] String optional

      jQuery selector for pause button

    • [pauseFocusSelector='.pause-on-focus'] String optional

      The class to pause the application when focused on. This is useful for form elements which require focus and play better with Application's keepFocus option.

_checkSoundMute

()
private

Defined in _checkSoundMute:80

Check for when all mutes are muted or unmuted

_internalOpen

(
  • path
  • [options]
)
protected

Defined in _internalOpen:119

Open a application or path

Parameters:

  • path String

    The full path to the application to load

  • [options] Object optional

    The open options

    • [singlePlay=false] Boolean optional

      If we should play in single play mode

    • [playOptions=null] Object optional

      The optional play options

_onCloseFailed

()
private

Defined in _onCloseFailed:378

If there was an error when closing, reset the container

_onDocClicked

(
  • e
)
private

Defined in _onDocClicked:149

When the document is clicked

Parameters:

  • e Event

    Click or focus event

_setMuteProp

(
  • prop
  • button
  • muted
)
protected

Defined in _setMuteProp:23

Abstract method to handle the muting

Parameters:

  • prop String

    The name of the property to save

  • button Jquery

    Reference to the jquery button

  • muted Boolean

    If the button is muted

blur

()

Defined in blur:79

Unfocus on the iframe's contentWindow

clearCaptionsStyles

()

Reset the captions styles

close

()

Defined in close:342

Tell the application to start closing

destroy

()

Defined in destroy:388

Destroy and don't use after this

destroyClient

()
protected

Defined in destroyClient:226

Removes the Bellhop communication layer altogether.

disableButton

(
  • button
)
private

Defined in disableButton:43

Disable a button

Parameters:

  • button Jquery

    The button to disable

focus

()

Defined in focus:70

Focus on the iframe's contentWindow

getCaptionsStyles

(
  • [prop]
)
Object

Get the captions styles

Parameters:

  • [prop] String optional

    The optional property, values are "size", "edge", "font", "background", "color"

Returns:

Object:

The collection of styles, see setCaptionsStyles for more info.

initClient

()
protected

Defined in initClient:203

Set up communication layer between site and application. May be called from subclasses if they create/destroy Bellhop instances.

manageFocus

()
protected

Defined in manageFocus:88

Manage the focus change events sent from window and iFrame

onContainerBlur

()
private

Defined in onContainerBlur:209

Handle blur events sent from container's window

onContainerFocus

()
private

Handle focus events sent from container's window

onEndGame

()
private

Defined in onEndGame:290

The application ended and destroyed itself

onFocus

()
private

Defined in onFocus:187

Handle focus events sent from iFrame children

onKeepFocus

()
private

Defined in onKeepFocus:176

Handle the keep focus event for the window

onLoadDone

()
private

Defined in onLoadDone:266

Reset the mutes for audio and captions

onLoading

()
private

Defined in onLoading:251

The game is starting to load

onLocalError

(
  • event
)
private

Defined in onLocalError:240

Handle the local errors

Parameters:

  • event Event

    Bellhop event

onMusicToggle

()
private

Defined in onMusicToggle:197

Handler when the music mute button is clicked

onPauseToggle

()
private

Defined in onPauseToggle:82

Toggle the current paused state of the application

onSFXToggle

()
private

Defined in onSFXToggle:219

Handler when the voice-over mute button is clicked

onSoundToggle

()
private

Defined in onSoundToggle:183

Handler when the sound mute button is clicked

onUserDataRead

()
private

Defined in onUserDataRead:51

Handler for the userDataRead event

onUserDataRemove

()
private

Defined in onUserDataRemove:37

Handler for the userDataRemove event

onUserDataWrite

()
private

Defined in onUserDataWrite:65

Handler for the userDataWrite event

onVOToggle

()
private

Defined in onVOToggle:208

Handler when the voice-over mute button is clicked

openPath

(
  • path
  • [options]
)

Defined in openPath:179

Open a application or path

Parameters:

  • path String

    The full path to the application to load

  • [options] Object optional

    The open options

    • [singlePlay=false] Boolean optional

      If we should play in single play mode

    • [playOptions=null] Object optional

      The optional play options

openRemote

(
  • api
  • [options]
)

Defined in openRemote:23

Open application based on an API Call to SpringRoll Connect

Parameters:

  • api String

    The path to API call, this can be a full URL

  • [options] Object optional

    The open options

    • [singlePlay=false] Boolean optional

      If we should play in single play mode

    • [playOptions=null] Object optional

      The optional play options

    • [query=''] String optional

      The application query string options (e.g., "?level=1")

reset

()

Defined in reset:300

Reset all the buttons back to their original setting and clear the iframe.

setCaptionsStyles

(
  • [styles]
  • [value]
)

Set the captions styles

Parameters:

  • [styles] Object | String optional

    The style options or the name of the property (e.g., "color", "edge", "font", "background", "size")

    • [color='white'] String optional

      The text color, the default is white

    • [edge='none'] String optional

      The edge style, default is none

    • [font='arial'] String optional

      The font style, default is arial

    • [background='black-semi'] String optional

      The background style, black semi-transparent

    • [size='md'] String optional

      The font style default is medium

    • [align='top'] String optional

      The align style default is top of the window

  • [value] String optional

    If setting styles parameter as a string, this is the value of the property.

_appBlurred

Boolean private

Defined in _appBlurred:34

Whether the Game is currently "blurred" (not focused) - for pausing/unpausing

Default: false

_captionsStyles

String private

Defined in _captionsStyles:50

The collection of captions styles

_containerBlurred

Boolean private

Whether the Container is currently "blurred" (not focused) - for pausing/unpausing

Default: false

_focusTimer

Int

Defined in _focusTimer:58

Delays pausing of application to mitigate issues with asynchronous communication between Game and Container

_isManualPause

Boolean private

Defined in _isManualPause:21

If the application is currently paused manually

Default: false

_keepFocus

Boolean private

Defined in _keepFocus:42

Always keep the focus on the application iframe

Default: false

_pageVisibility

springroll.PageVisibility private

Defined in _pageVisibility:23

Handle the page visiblity change events, like opening a new tab or blurring the current page.

_paused

Boolean private

Defined in _paused:29

If the current application is paused

Default: false

_plugins

Array private static

Defined in _plugins:111

The collection of Container plugins

CAPTIONS_MUTED

String private final static

Defined in CAPTIONS_MUTED:39

The name of the saved property if the captions are muted or not

CAPTIONS_STYLES

String private final static

Defined in CAPTIONS_STYLES:14

The name of the saved property for the captions styles

captionsButton

Jquery

Defined in captionsButton:62

Reference to the captions button

captionsMuted

Boolean

Defined in captionsMuted:73

Set the captions are enabled or not

Default: true

client

Bellhop

Defined in client:61

Communication layer between the container and application

DEFAULT_CAPTIONS_STYLES

Object private final static

The map of the default caption style settings

dom

Element

Defined in dom:55

The DOM object for the iframe

helpButton

Jquery

Defined in helpButton:14

Reference to the help button

helpEnabled

Boolean

Defined in helpEnabled:44

Set the captions are muted

iframe

Jquery

Defined in iframe:49

The current iframe jquery object

loaded

Boolean

Defined in loaded:73

Check to see if a application is loaded

loading

Boolean

Defined in loading:80

Check to see if a application is loading

MUSIC_MUTED

String private final static

Defined in MUSIC_MUTED:23

The name of the saved property if the music is muted or not

musicButton

Jquery

Defined in musicButton:59

Reference to the music mute button

musicMuted

Boolean

Defined in musicMuted:126

Set the music audio is muted

Default: true

name

String

Defined in name:43

The name of this class

options

Object

Defined in options:35

The options

pauseButton

Jquery

Defined in pauseButton:14

Reference to the pause application button

paused

Boolean

Defined in paused:37

If the current application is paused

Default: false

release

Object

Defined in release:67

The current release data

release

Object

Defined in release:17

The release object from SpringRoll Connect

sendMutes

Boolean

Defined in sendMutes:16

Should we send bellhop messages for the mute (etc) buttons?

Default: true

SFX_MUTED

String private final static

Defined in SFX_MUTED:41

The name of the saved property if the effects are muted or not

sfxButton

Jquery

Defined in sfxButton:66

Reference to the sound effects mute button

sfxMuted

Boolean

Defined in sfxMuted:144

Set the sound effect audio is muted

Default: true

SOUND_MUTED

String private final static

Defined in SOUND_MUTED:14

The name of the saved property if the sound is muted or not

soundButton

Jquery

Defined in soundButton:52

Reference to the all sound mute button

soundMuted

Boolean

Defined in soundMuted:90

Set the all sound is enabled or not

Default: false

userDataHandler

Object

Defined in userDataHandler:16

The external handler class, must include remove, write, read methods make it possible to use something else to handle the external, default is to use cookies/localStorage. See springroll.SavedDataHandler as an example.

Default: springroll.SavedDataHandler

version

String static

Defined in version:98

The current version of the library

Default: VERSION

VO_MUTED

String private final static

Defined in VO_MUTED:32

The name of the saved property if the voice-over is muted or not

voButton

Jquery

Defined in voButton:73

Reference to the voice-over mute button

voMuted

Boolean

Defined in voMuted:108

Set the voice-over audio is muted

Default: true

close

Defined in close:356

Event when a application starts closing

closed

Defined in closed:334

Event when a application closes

features

Defined in features:26

The features supported by the application

Event Payload:

  • data.vo Boolean

    If VO vo context is supported

  • data.music Boolean

    If music context is supported

  • data.sound Boolean

    If Sound is supported

  • data.sfx Boolean

    If SFX context is supported

  • data.captions Boolean

    If captions is supported

  • data.hints Boolean

    If hinting is supported

helpEnabled

Defined in helpEnabled:56

Fired when the enabled status of the help button changes

Event Payload:

  • enabled Boolean

    If the help button is enabled

localError

Defined in localError:362

There was an uncaught iframe error destroying the game on closing

Event Payload:

  • error Error

    The error triggered

open

Defined in open:171

Event when request to open an application has begin either by calling openPath or openRemote

opened

Defined in opened:283

Event when the application gives the load done signal

opening

Defined in opening:258

Event when a application start loading, first even received from the Application.

pause

Defined in pause:52

Fired when the pause state is toggled

Event Payload:

  • paused Boolean

    If the application is now paused

paused

Defined in paused:61

Fired when the application becomes paused

remoteError

Defined in remoteError:57

There was a problem with the API call

remoteFailed

Defined in remoteFailed:82

Fired when the API cannot be called

resumed

Defined in resumed:57

Fired when the application resumes from a paused state

unsupported

Defined in unsupported:143

Fired when the application is unsupported

Event Payload:

  • err String

    The error message