Use closures with engine.beginTimer in MIDI Script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mixxx |
Fix Released
|
Wishlist
|
Phillip Whelan | ||
1.10 |
Fix Released
|
Wishlist
|
Phillip Whelan | ||
1.11 |
Fix Released
|
Wishlist
|
Phillip Whelan |
Bug Description
It would be great to pass functions directly to engine.beginTimer and have it use the same context where the timer is being registered.
Here is an example of what engine.beginTimer can do now
function doTimer() {
}
engine.
With closures the same code can also be written as such:
engine.
Also since the context is being reused this same code actually works:
function doMidi() {
this.value = 1;
}
I have attached a patch which can be applied to trunk that accomplishes this functionality.
Related branches
Changed in mixxx: | |
status: | New → Confirmed |
Changed in mixxx: | |
status: | Confirmed → Triaged |
status: | Triaged → Fix Committed |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
Changed in mixxx: | |
status: | In Progress → Fix Committed |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
Hey Phil,
I see you only store 'this' for function arguments to beginTimer. Is there any reason not to also apply string arguments with the same 'this' as the beginTimer() caller environment's 'this'?