-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanaged.js
More file actions
35 lines (32 loc) · 820 Bytes
/
Copy pathmanaged.js
File metadata and controls
35 lines (32 loc) · 820 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
25
26
27
28
29
30
31
32
33
34
/* update prefs from the managed storage */
{
const once = () => {
if (once.done) {
return;
}
once.done = true;
chrome.storage.managed.get(null, rps => {
if (chrome.runtime.lastError) {
return;
}
if ('guid' in rps) {
chrome.storage.local.get({
guid: ''
}, prefs => {
if (prefs.guid !== rps.guid) {
chrome.storage.local.set(rps, () => {
console.info('Managed preferences are applied');
});
}
});
}
else {
if (Object.getOwnPropertyNames(rps).length) {
console.info('Managed preferences are ignored. Please set "guid"');
}
}
});
};
chrome.runtime.onStartup.addListener(once);
chrome.runtime.onInstalled.addListener(once);
}