Comments (1)
I'm going to hijack this issue with a radical idea; what if we got rid of Observer
entirely as a user-facing construct? Nobody actually uses them for anything except immediately piping it into an :onChange()
or :onBind()
call.
Things have changed a lot since 0.1 when this API surface was first introduced. Now that we have scopes, we've externalised all destruction tracking, so we can append code into the current scope to handle disconnecting the listener. Beyond that, what purpose does Observer
as a public-facing construct serve?
So my proposition is this; drop the API entirely, and replace Observer
with a function, observe()
or onChange()
or something like that. As far as the user cares, those functions connect the callback to be run in a new coroutine at some point soon after an update occurs. Maybe it also provides some nice options to track multiple state objects or run the callback immediately to match onBind
- I don't know, but all that matters is there's no object involved.
Under the hood, Fusion can now internally manage whatever reactive graph mechanisms it needs in order to dispatch those listeners. Fusion can count the number of listeners so that it destroys whatever internal objects its using once all listeners are disconnected.
From there, observe()
becomes the foundation atop which we can build other APIs, like perhaps a general connector for binding instances to properties, which can then be used in applyInstanceProps
(#304)
from fusion.
Related Issues (20)
- Fusion.Children should parent things in batching order HOT 7
- Allow T everywhere we publicly accept StateObject<T> HOT 1
- Dissolve state objects that don't deal with state HOT 4
- Rename CanBeState<T> to be more concise HOT 7
- Dealing with re-entrant updates HOT 2
- Introduce a more efficient connector between state and data model properties
- Heuristic memoisation for state objects HOT 1
- Add debugging protocol for non-invasive inspection
- Reuse scopes from primitive computed objects HOT 3
- Test what an ideal scope pool size is HOT 1
- Integrate under-documented APIs into tutorials
- Explore safer interpretations of `deriveScope` HOT 1
- Spring setters don't work immediately after construction
- Memoise special key generation functions
- Poor typechecking for use functions with UsedAs<T>
- Derive scopes with additional methods HOT 2
- Standard set of reactive graph shapes for testing HOT 1
- Write tutorial for `Safe` expressions
- Broken default props link (still uses .lua)
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 fusion.