Comments (10)
Would it be by reference of the handler or the getter?
from nuclear-js.
I was thinking with no arguments removes all handlers, and specific handlers can be removed by providing combinations of getters and handler function names.
reactor.unobserve() // no more observations for the entire reactor instance
reactor.unobserve(['some', 'keypath']) // no more observations on keypath changes
reactor.unobserve(someGetter) // no more observations on getter and/or ancestor changes
reactor.unobserve(someGetter, myHandler) // no more calls to myHandler
from nuclear-js.
the api seems pretty sane. I dont quite see the use case for doing a complete reactor.unobserve
where you wouldn't want to do an entire reactor.reset()
I could see the use for using it by getter
or getter
+ handler
. Have you been running into cases where you find yourself wanting this functionality?
from nuclear-js.
Fair point on reset
. I can't think of a use case for unobserving without reseting either.
For the most part we've limited our overall use of observe
, preferring to do things through actions. However, we do have a logging module and an analytics module, and those use observe
to do things based on app state changes.
It's not often, but sometimes, state changes in a way that means we don't want to (permissions, etc.) log/track anymore. In these case we perform cleanup of observers by keeping a set of maps, each with a mapping to the unwatch function, then looping over the set. Being able to call unobserve
on a particular keypath or getter, would be more terse and elegant IMO.
from nuclear-js.
@colindresj I am pretty busy with the NuclearJS doc sites. If you want to implement this functionality you are more than welcome to.
from nuclear-js.
Cool, I'll get a PR ready for this soon. Let me know if you need help on the docs site — would be happy to help.
from nuclear-js.
@colindresj - would love help on the docs site. lets chat soon
from nuclear-js.
Also doing everything in react + Nuclear, been really fun so far.
from nuclear-js.
I'm also interested in helping with the docs. Finally have started being able to use Nuclear at work =)
from nuclear-js.
Done in v1.2.0.
from nuclear-js.
Related Issues (20)
- Is it possible to use ReactMixin with ECMA6 class extension syntax? HOT 3
- Data Bindings as Props instead of State HOT 3
- [HELP]NuclearJS + Babel 6 as transpiler HOT 3
- Nuclear Module HOT 4
- [Question] How do dispatch one action within another action? HOT 2
- [Question] Data store dependency HOT 3
- Getter dependencies not being cached HOT 15
- ImmutableJS dependency HOT 7
- [HELP] NuclearJs reports "TypeError: Cannot read property 'dispatch' of undefined" HOT 5
- Logging fails on older Android browsers when called with `null` or `undefined` HOT 3
- Upgrade Immutable to the latest version HOT 2
- When using batch, do not receive error when calling dispatch inside of dispatch HOT 2
- reactor.dispatch throwing error 'VM31785:6061 Uncaught Error: `dispatch` cannot be called with an `undefined` action type.' HOT 1
- ES6 Support HOT 1
- Is this project still being maintained? HOT 3
- Disable Dispatch logs using debug packages HOT 3
- Observer not called HOT 2
- Active? HOT 2
- Github Project Template Files
- Online documentation is out of date vs source documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuclear-js.