Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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);
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: $(document).ready(function() { $(".menu-icon").on("click", function() { $("nav ul").toggleClass("showing"); }); }); 
Javascript :: coldfusion cfscript cflocation 
Javascript :: universal apollo kit 
Javascript :: javascript es6 dom manipulation 
Javascript :: load bmfont three with webpack 
Javascript :: target all element besides the clicked one 
Javascript :: ricavare una lettera di una stringa in javascript 
Javascript :: get minutes with 2 numbers 
Javascript :: vue change input value from console 
Javascript :: bbcode javascript html textarea 
Javascript :: how to set time with jwt token in node js 
Javascript :: save webcam capture in bmp npm 
Javascript :: onclick display array value javascript 
Javascript :: cordova read file in www folder 
Javascript :: map.getIn gives whole data if prop missing in js 
Javascript :: scala play json read single field 
Javascript :: use vue cdn with firestore 
Javascript :: JavaScript Populating a Hash 
Javascript :: overlapping times javascripts html django 
Javascript :: js vanilla detect any input 
Javascript :: javascript match image attribute value 
Javascript :: september 
Javascript :: how to securely post form data to api vuejs 
Javascript :: dom javascript cheat sheet 
Javascript :: click and copy jquery dynamic content 
Javascript :: capturar el id de un elemento con jquery 
Javascript :: Laravel bootstrap 5 install popper.js error 
Javascript :: Escaping special characters in JSON / list of invalid characters to strip from JSON string 
Javascript :: array.of 
Javascript :: install react-foundation library in react js 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =