-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.js
More file actions
24 lines (23 loc) · 691 Bytes
/
Copy pathutil.js
File metadata and controls
24 lines (23 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// polyfill - Chrome's API is not Promise-based
if (typeof chrome != 'undefined') {
browser = {
history: {
// TODO no possible failure given by callback?
search: q => {
return new Promise((ok, ko) => {
chrome.history.search(q, h => ok(h));
})
},
getVisits: url => {
return new Promise((ok, ko) => {
chrome.history.getVisits(url, v => ok(v));
});
}
},
i18n: chrome.i18n
};
}
// global object for unified logging
webnav = {
log: (msg) => console.log(`[${new Date().toISOString()}] ${msg}`)
};