signal-desktop/ts/util/universalExpireTimer.ts

15 lines
461 B
TypeScript
Raw Normal View History

2021-06-01 20:45:43 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2022-11-16 20:18:02 +00:00
import { DurationInSeconds } from './durations';
2021-06-01 20:45:43 +00:00
export const ITEM_NAME = 'universalExpireTimer';
2022-11-16 20:18:02 +00:00
export function get(): DurationInSeconds {
return DurationInSeconds.fromSeconds(window.storage.get(ITEM_NAME) || 0);
2021-06-01 20:45:43 +00:00
}
2022-11-16 20:18:02 +00:00
export function set(newValue: DurationInSeconds | undefined): Promise<void> {
return window.storage.put(ITEM_NAME, newValue || DurationInSeconds.ZERO);
2021-06-01 20:45:43 +00:00
}