mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-14 20:04:49 +08:00
16 lines
485 B
JavaScript
16 lines
485 B
JavaScript
import { load, store } from "./lib/storage";
|
|
|
|
const OPT_OUT_IDS_KEY = "confirm-opted-out-ids";
|
|
|
|
export function loadConfirmOptOutIds() {
|
|
return load(OPT_OUT_IDS_KEY) || [];
|
|
}
|
|
|
|
export function registerGlobalEventHandlersForConfirm() {
|
|
window.addEventListener("phx:add_confirm_opt_out_id", (event) => {
|
|
const optedOutIds = load(OPT_OUT_IDS_KEY) || [];
|
|
const optOutId = event.detail.opt_out_id;
|
|
optedOutIds.push(optOutId);
|
|
store(OPT_OUT_IDS_KEY, optedOutIds);
|
|
});
|
|
}
|