springroll.pbskids.Learning Class

Extends springroll.EventDispatcher
Module: Learning

The base game class

Constructor

springroll.pbskids.Learning

(
  • app
  • [showTray=false]
)

Parameters:

  • app springroll.Application

    The application reference

  • [showTray=false] Boolean optional

    Show the documentation at init or false (dev build only!)

_handleError

(
  • error
)
type
private

Defined in _handleError:184

Handle errors

Parameters:

  • error Error

    The error to handle

Returns:

type:

[description]

_onCalled

(
  • api
)
private

Defined in _onCalled:743

Handler when an api is called

Parameters:

  • api String

    The name of the API method called

_showError

(
  • message
  • api
  • [property]
)
private

Defined in _showError:895

Display an error in the tray

Parameters:

  • message String

    The message to log

  • api String

    The name of the api

  • [property] String optional

    Optional property

_specTrack

(
  • api
  • [extraArgs]
)
private

Defined in _specTrack:761

Generic method to track an event based on the spec, the arguments mirror the arguments in the event spec.

Parameters:

  • api String

    The name of the api

  • [extraArgs] optional multiple

    The Additional arguments

_startFeedback

(
  • api
)
private

Defined in _startFeedback:585

Basic method for starting a feedback or instruction

Parameters:

  • api String

    The event method to call

_startFeedback

(
  • api
  • description
  • identifier
  • mediaType
  • totalDuration
)
private

Defined in _startFeedback:556

Basic method for starting a feedback or instruction

Parameters:

  • api String

    The event method to call

  • description String

    Description of the instruction

  • identifier String

    A unique identifier

  • mediaType String

    Either audio animation or other

  • totalDuration Int

    The estimated time of instruction in milliseconds

_toggleRowCollapse

(
  • e
)
private

When clicking on a method name

Parameters:

  • e Event

    The click event

_track

(
  • api
  • [input]
  • [round]
)
private

Defined in _track:797

Generic method to track an event based on the spec, the arguments mirror the arguments in the event spec.

Parameters:

  • api String

    The name of the api

  • [input] Object optional

    The collection of argument values

  • [round] Int optional

    The explicit round to add the track event for

addMap

(
  • eventDictionary
)

Defined in addMap:225

The map of API event name overrides

Parameters:

  • eventDictionary Object

    The collection of game-specific APIs, this is a map of the eventCode to the name of the API method

clickPlay

(
  • coordinates
)

Defined in clickPlay:504

When a user clicks or taps on the play button to start the game.

Parameters:

  • coordinates Object

    The coordinates object

    • x Int

      The x position clicked or tapped

    • y Int

      The y position clicked or tapped

    • stage_width Int

      The stage width

    • stage_height Int

      The stage height

destroy

()

Defined in destroy:942

Don't use after this

endCorrectFeedback

()

End the correct feedback event

endGame

(
  • [exitType]
)

Defined in endGame:526

Override for the end game event

Parameters:

  • [exitType] String optional

    The exit type for certain games

endIncorrectFeedback

()

End the incorrect feedback

endInstruction

()

Defined in endInstruction:619

End the system initiated instruction

endMovie

()

Defined in endMovie:723

The movie ended

gameTime

() Int

Defined in gameTime:415

Get the amount of time since the start of the game

Returns:

Int:

The time since the beginning of the game in milliseconds

pollTimer

(
  • alias
)
Int

Defined in pollTimer:399

Check the current progress of a timer, this will not destory the timer

Parameters:

  • alias String

    The unique alias for this timer

Returns:

Int:

The timer in milliseconds

removeTimer

(
  • alias
)

Defined in removeTimer:439

This will clean-up and discard the timer and it can't be used again.

Parameters:

  • alias String

    The unique alias for this timer

requires

(
  • api
)
Boolean

Defined in requires:926

Require that an api has been called

Parameters:

  • api String

    The names of the method or API call

Returns:

Boolean:

If the api was called before

skipMovie

()

Defined in skipMovie:704

The user decided to skip the movie playback by clicking a skip button

startCorrectFeedback

(
  • description
  • identifier
  • mediaType
  • total_duration
)

Start the correct feedback event

Parameters:

  • description String

    The text description of the instruction

  • identifier String

    A unique identifier for this peice of instruction

  • mediaType String

    The type of media, audio animation or other

  • total_duration Int

    The estimated duration of the media in milliseconds

startGame

()

Defined in startGame:466

Override for start game event

startIncorrectFeedback

(
  • description
  • identifier
  • mediaType
  • total_duration
)

Start the incorrect feedback

Parameters:

  • description String

    The text description of the instruction

  • identifier String

    A unique identifier for this peice of instruction

  • mediaType String

    The type of media, audio animation or other

  • total_duration Int

    The estimated duration of the media in milliseconds

startInstruction

(
  • description
  • identifier
  • mediaType
  • total_duration
)

Start the system initiated instruction

Parameters:

  • description String

    The text description of the instruction

  • identifier String

    A unique identifier for this peice of instruction

  • mediaType String

    The type of media, audio animation or other

  • total_duration Int

    The estimated duration of the media in milliseconds

startMovie

(
  • movieId
  • duration
  • description
)

Defined in startMovie:681

The movie started

Parameters:

  • movieId String

    The identifier for the movie that's playing

  • duration Int

    The duration of the media playback in milliseconds

  • description String

    The text or description of the instruction

startTimer

(
  • alias
)

Defined in startTimer:381

Convenience function for measuring the duration which is common for many events. These timers respect the application being paused and should be use instead of implementing Date.now() or some other Date-based method.

Parameters:

  • alias String

    A unique alias for this timer

stopTimer

(
  • alias
)
Int

Defined in stopTimer:425

Stop a timer and get the final duration to send with an event. This will clean-up and discard the timer and it can't be used again.

Parameters:

  • alias String

    The unique alias for this timer

Returns:

Int:

The timer in milliseconds

toggleDocs

()

Defined in toggleDocs:330

Toogle the display of the documentation

updateTimers

(
  • elapsed
)
private

Defined in updateTimers:452

Handle the frame update

Parameters:

  • elapsed Int

    The number of milliseconds since the last update

_app

springroll.Application private

Defined in _app:94

The reference to the application

_body

Element private

Defined in _body:71

The body dom element, development build only!

_feedbackStartRound

Int private

Keep track of the round a feedback event was started on the ending event should dispatch the same round.

Default: null

_handle

Element private

Defined in _handle:57

The toggle handle dom element, development build only!

_history

Array private

Defined in _history:115

The collection of api methods called

_movie

Object private

Defined in _movie:108

The saved data for movie events

_round

Int private

Defined in _round:122

The current level number if support, null if unsupported

Default: null

_round

Int private

Defined in _round:130

The current round number if support, null if unsupported

Default: null

_timers

Object private

Defined in _timers:84

The collection of timers

_tray

Element private

Defined in _tray:48

The documentation dom element, development build only!

catalog

springroll.EventCatalog

Defined in catalog:34

Create a new instance of the event catalog

showTray

Boolean

Defined in showTray:346

Show the documentation panel, development build only!

spec

Object

Defined in spec:246

The tracking specification

Sub-properties:

throwErrors

Boolean static

Defined in throwErrors:155

If the Learning should throw errors

called

Defined in called:177

An api method was called, this happens before any validation

Event Payload:

  • api String

    The name of the api method called

learningEvent

Defined in learningEvent:166

An event is tracked

Event Payload:

  • data Object

    The event data

    • game_id String

      The unique game id

    • event_id String

      The unique event id

    • event_data Object

      The data attached to event

      • event_code Int
        The code of the event