Comments (8)
I'm intrigued over people that use Reflux for other things than React and I find it very interesting that you're circumventing AngularJS's dirty checking. Keep us posted with more info and if there are any particular challenges you get in to with AngularJS.
One of the challenges that I've found with AngularJS in comparison with React is rendering performance. I've been out of the loop with AngularJS and I don't know if there are any good ways to batch DOM usage in AngularJS (like React does with it's virtual dom implementation) to avoid unnecessary reflow calculations in the browser and other performance bottle necks.
from refluxjs.
So far, my experience with this has been very good inside angular. I've been experimenting with it in the context of directives, and i've found it to be pretty solid. However, there are a couple things i've noticed:
I'm using it with socket.io and the angular-fullstack base. What i found is that when socket.io syncs the response from the server with the data in reflux, it causes angular to actually re-build the dom object. This actually can work in your favor, depending on what you are doing... i think that behavior might simulate how react does it. HOWEVER, it can cause problems if you are depending on data in the scope to persist. In that case, you can use "track by" in your ng-repeat, and updates to the object will cause a digest instead of re-build.
In the case of directives, i believe that integrating Reflux gives me the ability to control dirty checking performance. if you look at how i did the directive up there:
var Completed = RefluxThingStoreService.listen(function(status, payload){
if(status==='created') {
var thing = element.children('.progressBar');
thing.remove();
}
scope.$digest();
});
When the data store updates, i can attach functionality to those actions and then run $digest() on that individual scope only if the parameters are met. This basically saves me from having to drop things onto the scope and create new watchers. now, i haven't tested this, but i'd be interested to find out if this is a good way to do things for performance.
Anyway, those are some initial thoughts.
from refluxjs.
@ericmcgregor any more insights on this topic since September?
from refluxjs.
Would be interested in a follow up too!
from refluxjs.
For the most part, it was really successful. Granted, this was never a
production application, but it really helped to simplify things.
Integrating into Angular was pretty effortless, i just simply returned a
store/actions from a angular.factory so i could inject it in the typical
angular fashion.
In terms of alerting angular to updates, that was pretty straight forward
as well. For the most part a $scope.$digest() would get the job done
inside of a listener callback. Binding actions on my controllers really
simplified things for me as well.
i'm trying to think what some of the gotchas were... but i'd have to go
back and take a look. there's probably a smart way to hook into Angulars
digest cycle with something like this and fully integrate it into the scope
and controllers. But overall, it's just like using Reflux. it's nice to
be able to hook into actions, especially inside of directives, and have the
UI respond.
On Fri, May 29, 2015 at 12:46 PM, William Buchwalter <
[email protected]> wrote:
Would be interested in a follow up too!
—
Reply to this email directly or view it on GitHub
#66 (comment).
from refluxjs.
I'm doing a bit of refactoring, and wanted to keep your experiences in particular in mind. Being able to apply reflux to an angular app (when it's primarily used by react users) is a good measure of cohesiveness.
from refluxjs.
Based on @ericmcgregor feedback, I started integrating reflux in a fairly large angular/TypeScript application, some hacks are needed to make it work, but it's pretty interesting this far.
from refluxjs.
Guys +1 to this idea ;)
I was just wondering @ericmcgregor why you use scope.$digest(); instead of scope.$evalAsync();
Angularjs $apply, $digest, and $evalAsync
from refluxjs.
Related Issues (20)
- init not firing HOT 1
- Object doesn't support property or method 'createActions' IE 11 HOT 1
- Support of React.js v16 HOT 6
- How are keys handled if a component is attached to multiple stores with the same key? HOT 2
- Async/await pattern with async actions HOT 3
- can we have react 16.x compatibility HOT 4
- TypeError: str.listen is not a function HOT 1
- Extending Reflux Store HOT 1
- async in Server Rendering HOT 1
- TypeError: Super expression must either be null or a function, not undefined HOT 1
- setState callback not executed in store HOT 2
- setState should support callbacks, same as the typical react setState HOT 1
- reflux store this.setState callback
- Store listening to actions after dismount
- async actions return undefined instead of Promise HOT 3
- Cannot Use Reflux Components With React getDerivedStateFromProps() Static Method HOT 3
- Roadmap questions HOT 5
- react组件中获取元素节点,使用focus方法,报错focus未定义
- Feature Request: Make Reflux available for Functional Components HOT 1
- Please mark project as dead
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 refluxjs.