Skip to content

storage

const storage: {
get: Promise<StorageEntry | null>;
getAll: Promise<StorageEntry[]>;
getAllAcrossPresentations: Promise<StorageEntry[]>;
getForPresentation: Promise<StorageEntry[]>;
query: Promise<StorageEntry[]>;
search: Promise<StorageEntry[]>;
save: Promise<StorageEntry>;
delete: Promise<void>;
};

Defined in: domains/storage.ts:178

get(name): Promise<StorageEntry | null>;

Get a single storage entry by name for the current presentation and user.

On Mobile Locker app hosts that implement GET /user/user-storage-entries/item?name=, this is a single-key read. Older hosts fall back to listing current-presentation entries.

Parameter Type Description
name string The key name of the entry to retrieve.

Promise<StorageEntry | null>

The matching StorageEntry, or null if not found.

MobileLockerError on network failure or server error.

getAll(): Promise<StorageEntry[]>;

Get all storage entries for the current presentation and user.

Promise<StorageEntry[]>

Array of StorageEntry objects.

MobileLockerError on network failure or server error.

getAllAcrossPresentations(): Promise<StorageEntry[]>;

Get all storage entries for the current user across every presentation.

Promise<StorageEntry[]>

Array of StorageEntry objects.

Previously misnamed getAllForPresentation (that name hit this same unrestricted list endpoint). Use getAll for the current presentation only.

MobileLockerError on network failure or server error.

getForPresentation(presentationID): Promise<StorageEntry[]>;

Get all storage entries for a specific presentation by ID.

Parameter Type Description
presentationID number The numeric ID of the presentation.

Promise<StorageEntry[]>

Array of StorageEntry objects.

MobileLockerError on network failure or server error.

query(filter?): Promise<StorageEntry[]>;

Query storage entries with optional filtering.

Outside the Mobile Locker app, filters are applied locally against IndexedDB.

Parameter Type Description
filter? StorageFilter Optional filter by name, presentation, date range, and limit.

Promise<StorageEntry[]>

Array of matching StorageEntry objects.

MobileLockerError on network failure or server error.

const entries = await mobilelocker.storage.query({ name: 'scan-results', limit: 10 })
search(text, filter?): Promise<StorageEntry[]>;

Full-text search across storage entry names and data.

Parameter Type Description
text string The search string. Matched against name and the stringified data.
filter? StorageFilter Optional pre-filter applied before the text search.

Promise<StorageEntry[]>

Array of matching StorageEntry objects.

MobileLockerError on network failure or server error.

save(name, data): Promise<StorageEntry>;

Save a value to storage under the given name.

Creates a new entry if one does not exist, or updates the existing entry. Outside the Mobile Locker app, persists to IndexedDB via localforage.

Parameter Type Description
name string The key name for the entry.
data unknown Any JSON-serializable value to store.

Promise<StorageEntry>

The saved StorageEntry.

MobileLockerError on network failure or server error.

await mobilelocker.storage.save('scan-results', { leads: [...] })
delete(name): Promise<void>;

Delete the storage entry with the given name.

Parameter Type Description
name string The key name of the entry to delete.

Promise<void>

MobileLockerError on network failure or server error.