arqex / fluxify Goto Github PK
View Code? Open in Web Editor NEWThe simplest Flux implementation.
License: GNU General Public License v2.0
The simplest Flux implementation.
License: GNU General Public License v2.0
Fluxify is swallowing errors.
Even a simple example like this does not show the error in the console. It does not display the "oops" is not defined error. This makes developing with fluxify very difficult if no errors are displayed.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://rawgit.com/arqex/fluxify/master/build/fluxify.js"></script>
<script>
var dispatcher = fluxify.dispatcher;
dispatcher.register( function(){
console.log( "here" );
oops.oops();
console.log( "not here" );
});
dispatcher.dispatch( "test" );
</script>
</head>
<body>
</body>
</html>
I was just looking through a few Flux implementations and stumbled upon fluxify. One major problem I have with Flux is the difficulty of building isomorphic apps. With React (no Flux) it's quite easy because you can pass the props to renderToString
and set the state directly on the component.
But with examples like Chat app you don't store the data on components; it's delegated to the stores. As a result, I cannot generate a component's markup since I can't pass the data via props anymore.
Does fluxify have a way around this problem?
Thanks.
You are not able to turn off
a handler due to a bug on line 45:
44 for (i = listeners.length - 1; i >= 0; i--) {
45 if( listeners[i] === listener )
46 listeners.splice( i, 1 );
47 }
Since the handler is pushed in as { callback: listener, once: once }
the check needs
to be for listeners[i].callback
.
I'd like to see a diff of what changed between 0.2.2 and 0.2.1, but there's no git tag for 0.2.2
Anyway I can add common functions to a store so that I can use them inside the actionCallbacks?
I propose that flux.doAction(undefined)
should throw an error. This gives the developer a faster debugging feedback cycle by getting an error immediately whenever an invalid value is passed as an action name. Thoughts?
In this fluxify, you use the updater in action callbacks to mutate the store values.
E.g.
actionCallbacks: {
changeName: function( updater, name ){
// Stores updates are only made inside store's action callbacks
updater.set( {name: name} );
}
}
In facebook ( excerpt below ), you can mutate the store value in the callback.
//From https://facebook.github.io/flux/docs/dispatcher.html
flightDispatcher.register(function(payload) {
if (payload.actionType === 'city-update') {
CityStore.city = payload.selectedCity;
}
});
So how do we update store values using just the store registered callback function?
http://github.com/wgehner/flux
As short as I could make it.
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.