chrome.history api - deleteRange -
chrome.history api - deleteRange -
the chrome.history api gives method:
deleterange
chrome.history.deleterange(object range, function callback)
removes items within specified date range history. pages not removed history unless visits fall within range.
(from https://developer.chrome.com/extensions/history#method-deleterange)
my question is: how define range?
i've tried using javascript date() objects don't seem work. using simple integers doesn't work.
editso turns out epoch event 1st of january, 1970, 00:00:00 utc
to right amount of miliseconds since used
var olddate = date.now();
for first startdate property ,
var newdate = date.now();
for enddate property.
in case coded turned out be:
chrome.history.deleterange( {starttime: olddate , endtime: newdate } , function(){ console.log("dates removed"); });
lots of bzlm helping this.
according documentation linked to, range object 2 properties, starttime
, endtime
, dates
represented in milliseconds since epoch.
so, example,
chrome.history.deleterange({ starttime: 1303125199, endtime: 1403125199 }, ...)
should work. javascript has built-in functionality convert date objects epochs.
google-chrome-extension
Comments
Post a Comment