Use Object.assign instead of shallowMerge
This commit is contained in:
parent
913df00f35
commit
34cd025487
|
@ -20,7 +20,6 @@ globals:
|
|||
prefs: false
|
||||
reportError: true
|
||||
getActiveTab: true
|
||||
shallowMerge: true
|
||||
t: true
|
||||
getCodeMirrorThemes: true
|
||||
setupLivePrefs: true
|
||||
|
|
4
edit.js
4
edit.js
|
@ -130,7 +130,7 @@ function initCodeMirror() {
|
|||
var isWindowsOS = navigator.appVersion.indexOf("Windows") > 0;
|
||||
|
||||
// default option values
|
||||
shallowMerge(CM.defaults, {
|
||||
Object.assign(CM.defaults, {
|
||||
mode: 'css',
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
|
@ -1591,7 +1591,7 @@ function showCodeMirrorPopup(title, html, options) {
|
|||
var popup = showHelp(title, html);
|
||||
popup.classList.add("big");
|
||||
|
||||
popup.codebox = CodeMirror(popup.querySelector(".contents"), shallowMerge({
|
||||
popup.codebox = CodeMirror(popup.querySelector(".contents"), Object.assign({
|
||||
mode: "css",
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
|
|
|
@ -14,7 +14,7 @@ function notifyAllTabs(request) {
|
|||
});
|
||||
});
|
||||
// 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);
|
||||
// notify self: the message no longer is sent to the origin in new Chrome
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!a || !b || typeof a != "object" || typeof b != "object") {
|
||||
return a === b;
|
||||
|
|
Loading…
Reference in New Issue
Block a user