1
2// Setting side
3const currentTime = (new Date()).toJSON();
4const items = { 'testdate': currentTime };
5chrome.storage.local.set(items, () => {
6 if (chrome.runtime.lastError) {
7 console.error(chrome.runtime.lastError.message);
8 }
9});
10
11
12//Getting side
13chrome.storage.local.get(['testdate'], (result) => {
14 if (chrome.runtime.lastError) {
15 console.error(chrome.runtime.lastError.message);
16 } else {
17 const storedJSONDate = result['testdate'];
18 const testdate = new Date(storedJSONDate);
19 console.log(testdate);
20 }
21});
22