store current date in chrome storage extension
// Setting side
const currentTime = (new Date()).toJSON();
const items = { 'testdate': currentTime };
chrome.storage.local.set(items, () => {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
}
});
//Getting side
chrome.storage.local.get(['testdate'], (result) => {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
} else {
const storedJSONDate = result['testdate'];
const testdate = new Date(storedJSONDate);
console.log(testdate);
}
});
Also in JavaScript:
- reverse a number in javascript without using inbuilt function
- js format date dd/mm/yyyy
- salvar no localStorage react
- check radio button is checked jquery
- javascript objectentries
- angular this web site use cookie example
- crypto node
- arrow functions javascript
- play sound javascript
- update one component from another component angular 9
- disable js on chrome
- how to read if a person has send a message on discord.js
- how to add multiple comment in react
- create react native app npx
- devolver nombre propiedades de objeto javascript
- get date in javascript
- javascript array loop
- javascript generate a random number between two numbers thats not 1
- store data in array jquery
- How find a specific character in js
- state in react
- discord.js clear code
- javascript remove first item from array
- javascript modal