I made a chrome extension that manages internet history, browser cookies, etc. I'm trying to make a notification if you don't run it for a week, so I used chrome.storage to save the timestamp whenever you use the extension.
Here's my code:
<popup.js>
function clear()
{
chrome.browsingData.removeHistory({"since":0}, callback);
var now = new Date();
chrome.storage.local.set({key: now}, function() {
console.log('Value is set to ' + now)
}
(callback is an empty function)
<background.js>
chrome.storage.local.get(["key"], function(result) {
alert (result.key)
});
When I tested this, it gave me:
[object Object]
Why is this code giving me this, not the timestamp I saved?