Skip to content

Module: session

Table of contents

Functions

Functions

getEntryPointAsync

getEntryPointAsync(): Promise<string>

Gets the entry point of where the game started from.

Example

Wortal.session.getEntryPointAsync()
 .then(entryPoint => console.log(entryPoint);

Returns

Promise<string>

Details about where the game started from.

Throws

NOT_SUPPORTED

RETHROW_FROM_PLATFORM


getEntryPointData

getEntryPointData(): Record<string, unknown>

Gets the data bound to the entry point.

Example

let data = Wortal.session.getEntryPointData();
console.log(data.property);

Returns

Record<string, unknown>

Data about the entry point or an empty object if none exists.


getLocale

getLocale(): string

Gets the locale the player is using.

Example

let lang = Wortal.session.getLocale();

Returns

string

Locale in BCP47 format.


getTrafficSource

getTrafficSource(): TrafficSource

Gets the traffic source info for the game.

Example

let source = Wortal.session.getTrafficSource();
console.log(source['r_entrypoint']);
console.log(source['utm_source']);

Returns

TrafficSource

URL parameters attached to the game.


setSessionData

setSessionData(data): void

Sets the data for this session. This is not persistent and is only used to populate webhook events.

Example

Wortal.session.setSessionData({
    'high-score': 100,
    'current-level': 2,
});

Parameters

Name Type Description
data Record<string, unknown> Data to set.

Returns

void