Skip to content
Permalink
Browse files

param-source: fix cleanup of old events

  • Loading branch information...
mmckegg committed Dec 30, 2017
1 parent fb37ecc commit 81865846e0c2bd897b7e32b1e37fb1ccc21dcef2
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/param-source.js
@@ -129,10 +129,11 @@ function ReducedParams (params, reducer) {
this.params = params
this.reducer = reducer
this.events = []
this.context = getContext(params)
}

ReducedParams.prototype.onEvent = function (listener) {
var context = this.params[0] && this.params[0].context
var context = this.context
var releases = this.params.map(param => ParamSource.isParam(param) && param.onEvent((event) => {
var duration = 0
var sampleTime = event.time
@@ -196,3 +197,11 @@ function cancelScheduledValues (source, time) {
function last (array) {
return array[array.length - 1]
}

function getContext (params) {
for (var i = 0; i < params.length; i++) {
if (params[i] && params[i].context) {
return params[i].context
}
}
}

0 comments on commit 8186584

Please sign in to comment.
You can’t perform that action at this time.