For the complete documentation index, see llms.txt. This page is also available as Markdown.

Storage.getItems

Feature Description

Retrieves multiple string values at once from the mobile app's local storage. The data is preserved even if the app is closed and restarted. Keys that have not been saved are also included in the result, and their value is nullis.

Toss app Android/iOS 5.270.0 It can be used on Android/iOS and later. Before calling Storage.getItems.isSupported()you can check whether it is supported. If you call it on an unsupported version, UNSUPPORTED_APP_VERSION an error occurs.

Type

Storage.getItems(keys: string[]): Promise<Record<string, string | null>>;

Params

type Keys = string[];

List of storage keys to retrieve.

Response

type GetItemsResult = Record<string, string | null>;

Returns the requested keys and their stored values as an object. The value of an unsaved key is nullis.

Error

Code
Description

UNSUPPORTED_APP_VERSION

Occurs immediately if the running version of the Toss app does not support this feature. Storage.getItems.isSupported()check in advance with error.messageand show it to the user.

Example code

import { Storage } from "@apps-in-toss/web-framework";

if (Storage.getItems.isSupported()) {
  const items = await Storage.getItems(["theme", "language"]);
  console.log(items.theme);
  console.log(items.language);
}

Was this helpful?