Packaging · class

NativePlatformServices

A store's achievements and presence, over the bridge.

Explained in Packaging an application.

class NativePlatformServices implements PlatformServices
import { NativePlatformServices } from '@driftengine/package';

In depth

Only created where a store answered. createHost returns null for services otherwise, which is the same shape the engine's own interface has: there is no browser implementation of PlatformServices because there is nothing honest for one to do, and a game that gets null simply never calls it.

Neither method reports failure, deliberately. An achievement that does not unlock is not a reason for a frame to stop, and a store that is offline is an ordinary state.

Constructor

new

constructor(bridge: DriftHostBridge)
ParameterTypeDescription
bridgeDriftHostBridge

Methods

unlockAchievement

unlockAchievement(id: string): void
ParameterTypeDescription
idstring

setRichPresence

setRichPresence(text: string): void
ParameterTypeDescription
textstring