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