Skip to content

Detecting changes in observable subscribers #331

@DanielMcCrystal

Description

@DanielMcCrystal

Is there any way to create a Property that represents the current set of subscribers on a given observable?

For example:

const obs = Kefir.fromPoll(100, () => "anything");
const obsSubscribers = obs.subscribers(); // << imaginary function
obsSubscribers.log();

setTimeout(() => {
    const fn = () => {...}
    const first = obs.onAny(fn);
    setTimeout(() => obs.offAny(fn), 2000)
}, 1000);
setTimeout(() => {
    const second = obs.onAny(...);
}, 2000);
s[0]----s[1]----s[2]----s[3]---
================
s[0] = [] << obs does not have any subscribers
s[1] = [first]
s[2] = [first, second]
s[3] = [second]

Or maybe just a boolean property that tracks whether or not the observable is active?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions