reearth.data 名前空間は、reearth プラグインにおけるクライアントサイドストレージを管理するメソッドを提供します。データの非同期な取得・更新・削除、ストレージキーの管理、およびストア全体のクリアが可能です。この名前空間は、ユーザー設定、セッションデータ、または一時的な設定を永続化する際に便利です。
reearth.data.clientStorage
Section titled “reearth.data.clientStorage”clientStorage は、軽量で非同期なキーバリューストレージシステムを管理するインターフェースを提供します。プラグインのクライアントサイドストレージに対して、読み取り・書き込み・削除などの操作を行うメソッドを備えています。
setAsync
Section titled “setAsync”キーと値のペアをストレージに保存します。
reearth.data.clientStorage.setAsync(key: string, value: unknown): Promise<void>型 string
値に関連付けるキーです。
型 unknown
保存する値です。
型 Promise<void>
キーと値のペアが保存されると解決される Promise です。
getAsync
Section titled “getAsync”指定したキーに関連付けられた値を取得します。
reearth.data.clientStorage.getAsync(key: string): Promise<unknown>型 string
取得する値のキーです。
型 Promise<unknown>
キーに関連付けられた値で解決される Promise です。キーが存在しない場合は undefined で解決されます。
keysAsync
Section titled “keysAsync”クライアントストレージに保存されているすべてのキーを取得します。
reearth.data.clientStorage.keysAsync(): Promise<string[]>型 Promise<string[]>
各キーを表す文字列の配列で解決される Promise です。
deleteAsync
Section titled “deleteAsync”指定したキーと値のペアをストレージから削除します。
reearth.data.clientStorage.deleteAsync(key: string): Promise<void>型 string
削除する値のキーです。
型 Promise<void>
キーと値のペアが削除されると解決される Promise です。
dropStoreAsync
Section titled “dropStoreAsync”クライアントストレージのすべてのデータを消去します。
reearth.data.clientStorage.dropStoreAsync(): Promise<void>型 Promise<void>
ストレージが消去されると解決される Promise です。