The alert's id
The fields to change
Whether the alert still exists
await updatePriceAlert(alert.id, { lastCheckedAt: Date.now(), failures: 0 });
export async function updatePriceAlert(
id: string,
changes: Partial<Omit<PriceAlert, 'id'>>,
): Promise<boolean> {
const key = priceAlertKey(id);
const current: unknown = (await cstorage.local.get(key))[key];
if (!isPriceAlert(current)) return false;
await cstorage.local.set({ [key]: { ...current, ...changes } });
return true;
}
Applies changes to an alert, unless it was removed in the meantime.