GithubHelp home page GithubHelp logo

ottoh / fluxex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zordius/fluxex

0.0 2.0 0.0 3.99 MB

An extended flux implement for both server/client side.

Home Page: https://www.npmjs.org/package/fluxex

License: Other

JavaScript 99.98% Shell 0.02%

fluxex's Introduction

fluxex

An extended flux implement for both server/client side.

npm version Dependency Status Build Status Test Coverage Code Climate License

See the Fluxex Magic

Check example projects you can see how fluxex do server side rendering + context deliver + Full HTML react rendering!

So far we do not include these in the example, but ....coming soon!

  • api call cross server/client
  • complex action creator

Difference with Flux

Fluxex is context based flux implemention. Server side react rendering can be done easy when the flux is scoped under a request based context. Store and dispatcher are singletons in Facebook flux, but in fluxex they are not.

Fluxex

  • Fluxex is an instance, it is constructed by provided context.
  • Fluxex can be serialized by .toString() and reconstructed by the serialized string. All server side store status can be transfered to client side by this way.

Action

  • An action creator should return a promise.
  • An action creator function can be executed with .executeAction() method under a Fluxex instance.
  • When the action be .executeAction(), the Fluxex instance can be referenced by this.
  • .executeAction() will return a promise, so you can manage asynchronous actions in promise way.

Dispatcher

  • the Fluxex instance itself is a dispatcher with .dispatch() method.
  • the dispatched FOOBAR action will trigger all stores with handleFOOBAR method under the Fluxex instance.

Store

  • Store is an instance, it is constructed by serialized status.
  • Store is created by a Fluxex object automatically.
  • Store naming and prototype information are provided by the .stores property of Fluxex instance.
  • Use .getStore(name) to get the store by name from an Fluxex instance.

Usage

Define your app

Provide store {name: implementation} pairs and Html.jsx location (example):

'use strict';

var commonStores = require('fluxex/extra/commonStores');

module.exports = require('fluxex').createApp({
    page: commonStores.page,
    productStore: require('./stores/product')
}, process.cwd() + '/components/Html.jsx');

.... to be continue ...

fluxex's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.