paldepind / flyd

The minimalistic but powerful, modular, functional reactive programming library in JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flyd.on subscriptions cannot be removed

teod opened this issue · comments

commented

Hello,
It's not possible to unsubscribe the .on listener on the flyd object. Shouldn't there be an .off method ? Is there a current workaround for this issue ?

That is a good point. You're welcome to do a PR. Otherwise I'll look at it in 2-4 days.

commented

Is using the map method a good workaround ?

    startStream() {
        "use strict";
        this.stream = flyd.map((smth)=> {
            ...
        }, SmthStream);
    }
    endStream() {
        "use strict";
        this.stream.end(true);
    }

Yes. You can very well do that!

Fixed by @gilbox in #64. I've updated the documentation.