GithubHelp home page GithubHelp logo

kryndex / exim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hy-dev/exim

0.0 1.0 0.0 679 KB

An ultra-lightweight Flux-like architecture for HTML5 apps using Facebook's React library.

Home Page: hellyeah.is/exim/

Makefile 0.41% JavaScript 95.07% HTML 4.52%

exim's Introduction

Exim.js Build Status

hellyeah.is/exim

An ultra-lightweight Flux-like architecture for HTML5 apps using Facebook's React library.

Install

npm install --save exim

If you're using Bower: bower install exim

Why

Because, we hate complexity. Redux is very complex. Adding Redux to your app won't solve any problem per se โ€” you would need to add tons of Redux plugins.

Exim focuses on three things:

  1. Simple actions with unidirectional flow. You cannot change app data from the outside.
  2. Easy lifecycle management and optimistic updates. Those are solid requirements for many modern apps.
  3. Being a first-class React citizen. Subscribing to data updates or calling an action should never be complex.
var User = Exim.createStore({
  fetch: {
    on(name) {
      return request.get('/v1/user/' + name);
    },
    did(response) {
      this.set({currentUser: response});
    },
    while(isFetching) {
      // This allows us to show a spinner.
      this.set({isFetching: isFetching});
    }
  },

  create: {
    on(data) {
      return request.put('/v1/user', data);
    },
    did(userInfo) {
      const list = this.get('users');
      list.push(userInfo);
      this.set({users: list}); // Immutable by default. Need to write updates explicitly.
    },
    didNot(error) {
      // Revert your optimistic updates here.
      console.error('Whoops. Something happened. You can revert some state here. Code:', error);
    }
  }
});

// In your view
React.createClass({
  mixins: [User.connect('isFetching')],
  create() {
    User.actions.create({name: 'Jonny Bravo'});
  },
  render() {
    if (this.isFetching) {
      return <div>Showing a spinner is as simple as that.</div>
    } else {
      return <div onClick={this.create}>Let me create something!</div>
    }
  }
});

Dependencies

The only hard dependency is React.js.

Changelog

Exim 0.9.0 (Dec 22, 2015)

  • Stores can now use propTypes to specify the exact data types of properties.
  • Massively improved debugging.

Exim 0.8.2 (Dec 13, 2015)

  • Add React Router 1.0 support.
  • Store's path argument is optional.

Exim 0.8.1 (Dec 11, 2015)

  • Fix temporary variables for will cycle.

Exim 0.8.0 (Dec 11, 2015)

  • while and on / did are now wrapped in transactions โ€” every data set would be groupped and then executed as one command instead of a few sets.
  • You can now use class as an alias to react's className for HTML tags.
  • cx helper enhancements.
  • Performance improvement.

Exim 0.7.0 (Aug 15, 2015)

  • Test release using Freezer.js for immutability.

Exim 0.6.2 (May 22, 2015)

  • Fix action's chain bug.

Exim 0.6.1 (May 16, 2015)

  • Implement store.reset() / store.reset(prop).
  • Getter: Revert logic. Fix allowed methods bug.
  • while[Action]: Fix didNot case bug.
  • Fix Unhandled rejection error.

Exim 0.6.0 (May 15, 2015)

  • Massive reduce in size. Exim is only 4K now (when gzipped).
  • Dropped all dependencies. But of course you'll need to include React.
  • Massive simplification.
  • Rewritten in ES6.

Exim 0.5.0 (May 6, 2015)

  • Implement Exim.createView.
  • Exim.Router enhancements.
  • Add Exim.helpers.

Exim 0.4.0 (Dec 9, 2014)

  • Initial release.

License

Exim is currently maintained by Paul Miller and Artem Yavorsky.

The MIT License (MIT)

Copyright (c) 2014 Hellyeah LLC http://hellyeah.is

With contributions by several individuals: https://github.com/hellyeahllc/exim/graphs/contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

exim's People

Contributors

chrismcv avatar goshacmd avatar paulmillr avatar shreeve avatar shvaikalesh avatar stelmakh avatar yavorsky avatar

Watchers

 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.