Skip to content

Latest commit

 

History

History
371 lines (214 loc) · 8.5 KB

ValkyrieWrapper.md

File metadata and controls

371 lines (214 loc) · 8.5 KB

@valkyrie-fnd/valkyrie-event-adapter / ValkyrieWrapper

Class: ValkyrieWrapper

Create an instance of ValkyrieWrapper and pass it the parent/wrapper window as well as an implementation of ValkyrieReceiver

const vw = new ValkyrieWrapper(window.parent, window, receiverImpl);
// Call init to register all listeners
const removeListeners = vm.init();
//...
removeListeners();

Calling init() the instance will set up listeners on window to listen for messages from wrapper. Use ValkyrieWrapper methods to post messages to wrapper.

Create an implementation of ValkyrieReceiver and pass it to ValkyrieWrapper. Its methods will be called when wrapper posts messages.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ValkyrieWrapper(parent, currTarget, receiver?)

Used to post messages to parent window

Parameters

Name Type Description
parent Window parent window to postMessage events to
currTarget EventTarget target to listen on postMessage events. Most likely window
receiver? ValkyrieReceiver implementation to receive messages from parent window

Defined in

valkyrie-wrapper.ts:34

Properties

parent

parent: Window

Defined in

valkyrie-wrapper.ts:25


receiver

receiver: ValkyrieReceiver

Defined in

valkyrie-wrapper.ts:27


target

target: EventTarget

Defined in

valkyrie-wrapper.ts:26

Methods

enterFullScreen

enterFullScreen(): void

If game provides fullscreen capability, call this when entering fullscreen so wrapper can handle that event.

Returns

void

Defined in

valkyrie-wrapper.ts:136


exitFullScreen

exitFullScreen(): void

If game provides fullscreen capability, call this when exiting fullscreen so wrapper can handle that event.

Returns

void

Defined in

valkyrie-wrapper.ts:142


gameBusy

gameBusy(): void

Call when game starts with player participation. Wrapper will avoid displaying any UI overlays while the game is busy.

Returns

void

Defined in

valkyrie-wrapper.ts:111


gameIdle

gameIdle(): void

Call when game becomes idle (betting time). Idle time can be used by the wrapper to display regulatory popups etc.

Returns

void

Defined in

valkyrie-wrapper.ts:104


gameLoadError

gameLoadError(errorMsg): void

Call when game fails to load. The wrapper can perform logging and automatic retries to try and recover.

Parameters

Name Type Description
errorMsg string will end up on reason property of sent message

Returns

void

Defined in

valkyrie-wrapper.ts:84


gameLoaded

gameLoaded(): void

Call once the game is loaded and has the UI ready to be shown to the player. Should not be called while the game is still in process of loading assets etc

Returns

void

Defined in

valkyrie-wrapper.ts:76


gameLoading

gameLoading(progress): void

Send game loading progress to wrapper. Should be called with 0 as soon as the page loads inside the iframe. Following, as the game starts loading, events with an increasing progress should be dispatched several times until the loading completes. A minimum number of 10 events is suggested.

Parameters

Name Type Description
progress number number between 0-100 to signal loading progress. Will be clamped between 0-100

Returns

void

Defined in

valkyrie-wrapper.ts:96


init

init(): () => void

call init after creating an instance, to set up listeners.

const vm = new ValkyrieWrapper(window.parent, window, receiverImpl);
const removeListeners = vm.init();
//....
// to remove listeners call returned function from init
removeListeners();

Returns

fn

function to remove event listeners

▸ (): void

call init after creating an instance, to set up listeners.

const vm = new ValkyrieWrapper(window.parent, window, receiverImpl);
const removeListeners = vm.init();
//....
// to remove listeners call returned function from init
removeListeners();
Returns

void

function to remove event listeners

Defined in

valkyrie-wrapper.ts:50


openCashier

openCashier(): void

Call when a Cashier or Deposit button is pressed within the game to instruct the wrapper to open the appropriate UI for that.

Returns

void

Defined in

valkyrie-wrapper.ts:117


openHome

openHome(): void

Call when Player navigates to home by pressing a "home" button.

Returns

void

Defined in

valkyrie-wrapper.ts:130


openLobby

openLobby(): void

Call when a Lobby or Home button is pressed within the game. The wrapper will be closed and user will be navigated to lobby or licensee page depending on casino configuration

Returns

void

Defined in

valkyrie-wrapper.ts:124


pauseAutoPlay

pauseAutoPlay(): void

Send pause auto play event to wrapper. If autoplay has been started withing the game, in order to sync state of play with wrapper

Returns

void

Defined in

valkyrie-wrapper.ts:149


resumeAutoPlay

resumeAutoPlay(): void

Send resume auto play event to wrapper. If autoplay has been started withing the game, in order to sync state of play with wrapper

Returns

void

Defined in

valkyrie-wrapper.ts:156


stopAutoPlay

stopAutoPlay(): void

Send stop auto play event to wrapper. If autoplay has been started withing the game, in order to sync state of play with wrapper

Returns

void

Defined in

valkyrie-wrapper.ts:163