-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
41 lines (36 loc) · 898 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Crumbs, { parseAccepted } from "./lib";
document.addEventListener("DOMContentLoaded", () => {
const editCookieButton = document.querySelector(".js-edit");
const ul = document.querySelector(".js-accepted");
const callback = (types) => {
clear();
Object.keys(types)
.filter((key) => types[key])
.forEach((key) => {
const li = document.createElement("li");
li.textContent = key;
ul.append(li);
});
};
const cookies = new Crumbs({
banner: {
title: "We use cookies",
description: "Test description",
},
callbacks: {
load: callback,
save: callback,
},
days: 365,
domain: "localhost",
editBanner: {
description: "This is for editing cookies",
title: "Edit cookies",
},
editCookieButton,
version: 1,
});
function clear() {
ul.innerHTML = "";
}
});