Skip to content

Commit

Permalink
Hercules P32: use Function.prototype.bind for QJSEngine
Browse files Browse the repository at this point in the history
The old	hacks for preserving the "this" object for
engine.makeConnection, engine.connectControl, and
engine.beginTimer do not work with QJSEngine, but QJSEngine
brings support for ES5,	which supports Function.prototype.bind.
https://bugs.launchpad.net/mixxx/+bug/1733666
  • Loading branch information
Be-ing committed Nov 24, 2018
1 parent ed4b00c commit ccbc73c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions res/controllers/Hercules-P32-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ P32.slipButton = new components.Button({
connect: function () {
for (var d = 1; d <= 4; d++) {
this.connections.push(
engine.connectControl('[Channel' + d + ']', 'slip_enabled', this.output)
engine.connectControl('[Channel' + d + ']', 'slip_enabled', this.output.bind(this))
);
}
},
Expand Down Expand Up @@ -222,9 +222,9 @@ P32.Deck = function (deckNumbers, channel) {
};
},
connect: function () {
this.connections[0] = engine.connectControl(this.group, 'beatloop_size', this.output);
this.connections[0] = engine.connectControl(this.group, 'beatloop_size', this.output.bind(this));
if (loopEnabledDot) {
this.connections[1] = engine.connectControl(this.group, 'loop_enabled', this.output);
this.connections[1] = engine.connectControl(this.group, 'loop_enabled', this.output.bind(this));
}
},
output: function (value, group, control) {
Expand Down

0 comments on commit ccbc73c

Please sign in to comment.