raynos / observ Goto Github PK
View Code? Open in Web Editor NEWA observable value representation
License: MIT License
A observable value representation
License: MIT License
Is it possible to remove a listener?
It's possible to implement an efficient computed
that does branch detection and only re-evaluates the computed function when it's real dependencies changes.
see http://www.youtube.com/watch?v=mVjpwia1YN4#t=12m32s for reference on this issue
Currently
var d = computed([a, b, c], function fn(a, b, c) {
return a ? b : c
})
fn
get's called when a
is true and c
has changed. In that call path it returns b
and the result of d
is the same.
If we could write something like
var d = cleverComputed(function () {
return a() ? b() : c()
})
In this case d
can internally remember that it depends on a
and b
in the a === true
branch and will not re-call itself when c
changes. However when a
changes d
will set its internal dependencies to a
and c
instead.
not sure how to do this without a global state machine.
cc @Matt-Esch
Since reactivity is emerging pattern in JS ecosystem, wouldn't it be nice to come to common ground?
observable/observ are now the main alternative observable API, compared to the proposal.
If observ implemented Symbol.observable
, it would enable interop and make one more step towards standard reactive pattern.
Hi,
Question; when onchange fires, would it be an idea to pass the "path" of the element that triggered the onchange? Or to in some other way be able to filter the event.
The use cases would perhaps be when dealing with multiple deep brances, when dealing with "live" data being pushed to the client, or when heavy manipulation of the data is done on the way to the view...
Hey,
I think it would be cool to integrate the combination of vtree and observ with https://github.com/dominictarr/scuttlebutt.
This shouldn't be too hard, since scuttlebutt has an API similar to observ.
I was a bit surprised that observ/computed
tries to get the value of each of it's dependent observables upon initiation. This is contrary to how observ
values themselves work. Or am I misunderstanding something?
I'd be delighted to propose a PR if you think either of those are valid thoughts.
Cheers ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.