I read your code and found attach(observer) function in your throttle.js file a bit wrong.
your code is :
attach(observer) {
let scheduled = false;
let value = undefined;
return this.stream.attach(val => {
value = this.accumulator(val);
if (!scheduled) {
setTimeout(() => {
scheduled = false;
observer(value);
});
}
}, this.delay)
}
And I think the "this.delay" may be in the wrong place since it is outside the setTimeout function. it is actually a parameter of attach function, but I searched for all files found that no attach function receives two paramters.
I read your code and found attach(observer) function in your throttle.js file a bit wrong. your code is : attach(observer) { let scheduled = false; let value = undefined; return this.stream.attach(val => { value = this.accumulator(val); if (!scheduled) { setTimeout(() => { scheduled = false; observer(value); }); } }, this.delay) }
And I think the "this.delay" may be in the wrong place since it is outside the setTimeout function. it is actually a parameter of attach function, but I searched for all files found that no attach function receives two paramters.