Comments (2)
@gnimmelf observ
is a single value. you listen to it and you get the entire new value when it changes.
@gnimmelf if you take a look at observ-struct
and observ-array
you can see they both support a feature called _diff
https://github.com/Raynos/observ-struct/blob/master/index.js#L39-L42
https://github.com/Raynos/observ-array/blob/master/splice.js#L45
In observ-struct
and observ-array
the _diff
property is the most recent thing that caused a change, it is both the path and the value.
If you nest observ-struct
and observ-array
recursively the _diff
will be a deeply nested diff object that will give you this information!
One trick I use in mercury
a lot is
var state = window.state = mercury.struct({
...
})
Then in the browser dev tools I do window.state(function (x) { console.log('diff', x._diff) })
So I basically see exactly what changes when I click around :)
from observ.
Indeed! Cool. Then it's settled: I'll swap out my own "masterpiece" with mercury.struct :-)
from observ.
Related Issues (9)
- observ should call the listener with the initial state
- Efficient implementation of `computed`
- observ-ations (any truthy value is a listener) HOT 5
- Integrate with scuttlebutt? HOT 1
- Any chance we could add isObservable() and isComputed(), similar to Knockout? HOT 5
- observ/computed calles dependent observables immediatly HOT 2
- Explain how to unwatch value in README HOT 4
- Interop: implement Symbol.observable?
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 observ.