2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2019 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { StorageAccessType } from '../types/Storage.d';
|
2021-06-15 00:09:37 +00:00
|
|
|
|
2020-09-16 19:31:05 +00:00
|
|
|
// Matching window.storage.put API
|
2022-12-21 18:41:48 +00:00
|
|
|
export async function put<K extends keyof StorageAccessType>(
|
2021-06-15 00:09:37 +00:00
|
|
|
key: K,
|
|
|
|
value: StorageAccessType[K]
|
2022-12-21 18:41:48 +00:00
|
|
|
): Promise<void> {
|
|
|
|
await window.storage.put(key, value);
|
2019-05-16 22:32:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-15 00:09:37 +00:00
|
|
|
export async function remove(key: keyof StorageAccessType): Promise<void> {
|
2020-07-24 23:32:08 +00:00
|
|
|
await window.storage.remove(key);
|
2019-05-16 22:32:11 +00:00
|
|
|
}
|