forked from locomojis/Chromoji
-
Notifications
You must be signed in to change notification settings - Fork 1
/
background.js
22 lines (21 loc) · 860 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(function bkgrd(window, undefined) {
'use strict';
if (localStorage.hidePrivate == null) localStorage.hidePrivate = true;
if (localStorage.blacklist == null) localStorage.blacklist = 'one.example,another.example';
function listenEmo(request, sender, sendResponse) {
'use strict';
var clone = function clone(dest, strt) {
for (var prop in strt) {
if (strt.hasOwnProperty(prop)) {
if ((typeof strt[prop] === 'object' || typeof strt[prop] === 'function') &&
strt[prop] !== null && dest[prop]) clone(dest[prop], strt[prop]);
else dest[prop] = strt[prop];
}
}
}, response = Object.create(Object.getPrototypeOf(request));
clone(response, request);
if (request.setting) response.result = localStorage[request.setting];
sendResponse(response);
}
chrome.extension.onMessage.addListener(listenEmo);
}(this));