Skip to content

Module: Stats

Table of contents

Functions

Functions

getStatsAsync

getStatsAsync(level, payload?): Promise<Stats[]>

Gets a player's stats.

Example

Wortal.stats.getStatsAsync("Level 1")
   .then((stats) => {
     console.log(stats);
   });

Parameters

Name Type Description
level string | number The name of the level to get stats for.
payload? GetStatsPayload Payload with additional details about the stats.

Returns

Promise<Stats[]>

Promise that resolves to an array of stats.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAMS

postStatsAsync

postStatsAsync(level, value, payload?): Promise<void>

Posts a player's stats.

Example

Wortal.stats.postStatsAsync("Level 1", "100")
  .then(() => {
     console.log("Stats posted successfully");
  });

Parameters

Name Type Description
level string | number The name of the level the stats are for.
value number The value of the stat.
payload? PostStatsPayload Payload with additional details about the stats.

Returns

Promise<void>

Promise that resolves when the stats have been posted.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAMS