Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions res/controllers/common-controller-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,15 @@ const isSimpleObject = function(obj) {
return obj !== null && typeof obj === "object" && obj.constructor.name === "Object";
};

script.isSimpleObject = isSimpleObject;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be exported.


/**
* Deeply merges 2 objects (Arrays and Objects only, not Map for instance).
* @param target {object | Array} Object to merge source into
* @param source {object | Array} Object to merge into source
* @deprecated Use {@link Object.assign} instead
*/
const deepMerge = function(target, source) {
script.deepMerge = function(target, source) {
console.warn("script.deepMerge is deprecated; use Object.assign instead");

if (target === source || target === undefined || target === null || source === undefined || source === null) {
return;
}
Expand All @@ -190,8 +191,6 @@ const deepMerge = function(target, source) {
}
};

script.deepMerge = deepMerge;

// ----------------- Mapping constants ---------------------

// Library column value, which can be used to interact with the CO for "[Library] sort_column"
Expand Down
17 changes: 16 additions & 1 deletion res/controllers/lodash.mixxx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
;(function() {
const DEPRECATION_MSG = (
"Lodash is deprecated and will be removed in a future release of Mixxx; refer to the page " +
"https://github.com/mixxxdj/mixxx/wiki/Lodash-Migration for migrations instructions"
);

console.warn(DEPRECATION_MSG);

/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
Expand Down Expand Up @@ -17068,8 +17074,17 @@
/*--------------------------------------------------------------------------*/

// Export lodash.
/**
* @deprecated since 2.5.0
* @global
*/
var _ = runInContext();

// Export to the global object.
root._ = _;
Object.defineProperty(root, "_", {
get() {
console.warn(DEPRECATION_MSG);
return _;
}
})
}.call(this));
30 changes: 30 additions & 0 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,13 @@
// Unset isShifted for each ComponentContainer recursively
this.isShifted = false;
},
/**
* @param newLayer Layer to apply to this
* @param reconnectComponents Whether components should be reconnected or not
* @deprecated since 2.5.0. Use @{ComponentContainer#setLayer} instead
*/
applyLayer: function(newLayer, reconnectComponents) {
console.warn("ComponentContainer.applyLayer is deprecated; use ComponentContainer.setLayer instead");
if (reconnectComponents !== false) {
reconnectComponents = true;
}
Expand All @@ -670,6 +676,30 @@
});
}
},
/**
* @param newLayer Layer to apply to this
* @param reconnectComponents Whether components should be reconnected or not
*/
setLayer(newLayer, reconnectComponents) {
if (reconnectComponents !== false) {
reconnectComponents = true;
}
if (reconnectComponents === true) {
this.forEachComponent(function(component) {
component.disconnect();
});
}

Object.assign(this, newLayer);

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

},
Comment on lines +683 to +702
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to create a copy with the new behavior so that it is more explicit that the implementation changes.

shutdown: function() {
this.forEachComponent(function(component) {
if (component.shutdown !== undefined
Expand Down