-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.js
More file actions
39 lines (33 loc) · 1.04 KB
/
Copy pathreset.js
File metadata and controls
39 lines (33 loc) · 1.04 KB
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
//resets locally stored data
var reset = document.getElementById("reset");
reset.addEventListener("click", function () {
var text = document.getElementById("text");
text.value = "";
postDataRemover();
localStorage.removeItem("log");
});
function postDataRemover() {
var posts = JSON.parse(localStorage.getItem("log"));
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = posts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
p = _step.value;
localStorage.removeItem(p);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}