derbyjs / racer

Realtime model synchronization engine for Node.js
1.18k stars 117 forks source link

Add option to unsubscribe or unfetch from a model or query immediately #227

Closed ghost closed 9 years ago

ghost commented 9 years ago

This pull request allows a model or query to ignore model.root.unloadDelay when unsubscribing or unfetching.

model.unsubscribe and model.unfetch now have the function signatures:

model.subscribe(items..., callback(err), immediate)
model.unfetch(items..., callback(err), immediate)

As a result of this change, it's possible to unsubscribe and subsequently resubscribe to the same collection (with different database queries) without waiting for model.root.unloadDelay to time out.

ghost commented 9 years ago

Looks like query.ref() resolves this more elegantly