Package
@persistlyapp/sdk
Install this package for browser games, Vite apps, and JavaScript wrappers.
Open npm packageJavaScript Setup
Install the public package, configure it with a runtime key, and start with PersistlyGameSaves before using lower-level runtime APIs.
Install
npm install @persistlyapp/sdkNo Build Step
For production apps, prefer npm plus your normal bundler. The jsDelivr ESM import is useful when a small browser demo should run from one HTML file.
<script type="module">
import {
PersistlyGameSaveStatus,
PersistlyGameSaves,
} from "https://cdn.jsdelivr.net/npm/@persistlyapp/sdk@1/+esm";
await PersistlyGameSaves.configure({
runtimeKey: "ps_test_replace_me",
});
await PersistlyGameSaves.shared.saveData({
level: 1,
coins: 50,
});
const sync = await PersistlyGameSaves.shared.forceSyncData();
if (sync.status === PersistlyGameSaveStatus.Synced) {
console.log("Synced to Persistly.");
}
</script>Configure
import { PersistlyGameSaves } from "@persistlyapp/sdk";
await PersistlyGameSaves.configure({
runtimeKey: "ps_test_replace_me",
});Package
Normal browser integrations only need a runtime key. Persistly uses its built-in localStorage adapter by default; pass storageHelper only if your game needs a custom local storage implementation.
Package
Install this package for browser games, Vite apps, and JavaScript wrappers.
Open npm packageRepository
Use the public GitHub repository for source, releases, and examples.
Open GitHub repoCDN
Use this import URL for plain HTML demos, quick browser prototypes, and no-build examples.
Open CDN moduleAvoid These Mistakes
Do not use playerRef as a public runtime lookup key from shipped clients.
Do not start with raw create/load/sync unless you intentionally need the advanced runtime contract.
Do not compare raw status strings. Use PersistlyGameSaveStatus and PersistlySyncStatus constants.