SponsorkitStorage
Where the SDK keeps its per-target-set document.
Where the SDK keeps its per-target-set document. Implementations store an
opaque JSON string per targetsHash.
Built in: localStorageAdapter() (browsers), memoryStorage(), and
fileStorage(dir) from @sponsorkit/sdk/node.
import type { SponsorkitStorage } from "@sponsorkit/sdk";
interface SponsorkitStorage { … }Interface, exported from @sponsorkit/sdk, @sponsorkit/sdk/node.
Methods#
read()#
read(targetsHash: string): string | null | Promise<string | null>The stored JSON for targetsHash, or null.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
targetsHash | string | required |
Returns string | null | Promise<string | null>
write()#
write(targetsHash: string, json: string): void | Promise<void>Replaces the stored JSON for targetsHash. Should be atomic.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
targetsHash | string | required | |
json | string | required |
Returns void | Promise<void>