Open SteveFortune opened 9 years ago
SubStance should allow you to register (injectable) functions which return subscription payloads containing reactive dependencies (note the calls to Session.get
). Internally, this is how we might manage them:
_reactivePayloads
._reactivePayloads
list, aggregating the results of all these
-- Checks determines which current subs to stop and which to invoke
-- Wraps the process of actually doing this in a Tracker.nonreactive
block so that these subs aren't auto stopped on the next computation invalidation. This allows us to manage how the subs are cleaned up (i.e. in our deferred discard queue).
-- I.e. we use this computation as an opportunity to reassess which subscriptions should be open and which should be discarded$$autorun
property, so we can tell whether they should be actively discarded as part of the autorun migration.I think we should also consider decoupling the subscription store from $subs
. We could have a $subRepo
service will the following methods:
exists(key)
discard(key)
add(payload)
existsAndKeep(key)
\ atomically tests whether a subscription still exists for a given key and keep it if it does ?This might manage the queue internally. The $subs
would just be responsible for deciding when to post add
and discard
messages to the repo.
Support the following sub config:
..and: