Skip to content

Commit

Permalink
Components.js: remove dependency on Lodash
Browse files Browse the repository at this point in the history
Lodash's assign function is no longer needed with Object.assign in ES6
with Qt 5.12. The ComponentContainer.applyLayer function ended up not
being used and only confused people, so it is being removed instead of
rewriting it to not Lodash.
  • Loading branch information
Be-ing committed Dec 28, 2018
1 parent ecedd59 commit a4c198b
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if (Array.isArray(options) && typeof options[0] === 'number') {
this.midi = options;
} else {
_.assign(this, options);
Object.assign(this, options);
}

if (typeof this.unshift === 'function') {
Expand Down Expand Up @@ -444,9 +444,7 @@
Encoder.prototype = new Component();

var ComponentContainer = function (initialLayer) {
if (typeof initialLayer === 'object') {
this.applyLayer(initialLayer);
}
Object.assign(this, initialLayer);
};
ComponentContainer.prototype = {
forEachComponent: function (operation, recursive) {
Expand Down Expand Up @@ -534,25 +532,6 @@
this.isShifted = false;
});
},
applyLayer: function (newLayer, reconnectComponents) {
if (reconnectComponents !== false) {
reconnectComponents = true;
}
if (reconnectComponents === true) {
this.forEachComponent(function (component) {
component.disconnect();
});
}

_.merge(this, newLayer);

if (reconnectComponents === true) {
this.forEachComponent(function (component) {
component.connect();
component.trigger();
});
}
},
};

var Deck = function (deckNumbers) {
Expand Down

0 comments on commit a4c198b

Please sign in to comment.