Use Object.assign instead of shallowMerge
This commit is contained in:
parent
913df00f35
commit
34cd025487
|
@ -20,7 +20,6 @@ globals:
|
||||||
prefs: false
|
prefs: false
|
||||||
reportError: true
|
reportError: true
|
||||||
getActiveTab: true
|
getActiveTab: true
|
||||||
shallowMerge: true
|
|
||||||
t: true
|
t: true
|
||||||
getCodeMirrorThemes: true
|
getCodeMirrorThemes: true
|
||||||
setupLivePrefs: true
|
setupLivePrefs: true
|
||||||
|
|
4
edit.js
4
edit.js
|
@ -130,7 +130,7 @@ function initCodeMirror() {
|
||||||
var isWindowsOS = navigator.appVersion.indexOf("Windows") > 0;
|
var isWindowsOS = navigator.appVersion.indexOf("Windows") > 0;
|
||||||
|
|
||||||
// default option values
|
// default option values
|
||||||
shallowMerge(CM.defaults, {
|
Object.assign(CM.defaults, {
|
||||||
mode: 'css',
|
mode: 'css',
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
|
@ -1591,7 +1591,7 @@ function showCodeMirrorPopup(title, html, options) {
|
||||||
var popup = showHelp(title, html);
|
var popup = showHelp(title, html);
|
||||||
popup.classList.add("big");
|
popup.classList.add("big");
|
||||||
|
|
||||||
popup.codebox = CodeMirror(popup.querySelector(".contents"), shallowMerge({
|
popup.codebox = CodeMirror(popup.querySelector(".contents"), Object.assign({
|
||||||
mode: "css",
|
mode: "css",
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
|
|
|
@ -14,7 +14,7 @@ function notifyAllTabs(request) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// notify all open popups
|
// notify all open popups
|
||||||
var reqPopup = shallowMerge({}, request, {method: "updatePopup", reason: request.method});
|
const reqPopup = Object.assign({}, request, {method: 'updatePopup', reason: request.method});
|
||||||
chrome.runtime.sendMessage(reqPopup);
|
chrome.runtime.sendMessage(reqPopup);
|
||||||
// notify self: the message no longer is sent to the origin in new Chrome
|
// notify self: the message no longer is sent to the origin in new Chrome
|
||||||
if (typeof applyOnMessage !== 'undefined') {
|
if (typeof applyOnMessage !== 'undefined') {
|
||||||
|
|
11
storage.js
11
storage.js
|
@ -521,17 +521,6 @@ function deepMerge(target, obj1 /* plus any number of object arguments */) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shallowMerge(target, obj1 /* plus any number of object arguments */) {
|
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
|
||||||
var obj = arguments[i];
|
|
||||||
for (var k in obj) {
|
|
||||||
target[k] = obj[k];
|
|
||||||
// hasOwnProperty checking is not needed for our non-OOP stuff
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
function equal(a, b) {
|
function equal(a, b) {
|
||||||
if (!a || !b || typeof a != "object" || typeof b != "object") {
|
if (!a || !b || typeof a != "object" || typeof b != "object") {
|
||||||
return a === b;
|
return a === b;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user