Closed ecwyne closed 9 years ago
I'd love to accept a PR for this, but unfortunately it's not as simple as your proposed implementation because Tracker.currentComputation
will not be the correct object. It might require changing the result caching to be global instead of per-computation.
@stubailo
Here's a working implementation. I would love to hear your thoughts https://github.com/stubailo/meteor-reactive-method/compare/master...ecwyne:master
Wow, looks nice!
Going to review now.
Done! Published 1.0.2 with this feature. I decided to split up invalidateCall
and invalidateApply
, seemed cleaner than supporting two APIs in one.
Great! Glad to have this feature! Glad you were able to figure out a way to not store computations forever!
Haha yeah with these kinds of libraries it's easy to accidentally introduce memory leaks..
It would be useful to trigger ReactiveMethod to invalidate previously returned results and rerun.
Proposed API
Implementation
reactive-method.js
I am more than willing to implement this and create a PR. I believe this method could be called "invalidate" or "changed" or "rerun", did't know if you'd have any preferences or any other thoughts on implementing this API @stubailo