1.5.2 • Published 7 years ago

rigby v1.5.2

Weekly downloads
22
License
MIT
Repository
github
Last release
7 years ago

Build Status

rigby

React is great, but... y'know

Installation

npm i rigby

Creating a Store

Rigby.createStore('YourStoreName', {
  state: {
    todos: [
      { 
        text: 'Your Data Goes Here',
        complete: false
      }
    ]
  },
  actions: {
    addTodo: function(text, complete) {
      this.state.todos.push({ text: text, complete: complete });
      this.emitChange();
    }
  }
});

Or with ES2015+:

import Store from "rigby";

class YourStore extends Store {
  constructor() {
    super("YourStoreName");

    this.state.todos = [ 
      { text: "Your Data Goes Here", complete: false }
    ];
  }

  addTodo(text, complete) {
      this.state.todos.push({ text, complete });
      this.emitChange();
  }
}

Or with TypeScript:

import Store from "rigby";

interface ToDo {
  text: string;
  complete: boolean;
}

interface YourStoreState {
  todos: ToDo[];
}

class YourStore extends Store<YourStoreState> {
  constructor() {
    super("YourStoreName");

    this.state.todos = [ 
      { text: "Your Data Goes Here", complete: false }
    ];
  }

  addTodo(text: string, complete: boolean) {
      this.state.todos.push({ text, complete });
      this.emitChange();
  }
}

Dispatching Actions

import Rigby from "rigby";

Rigby.dispatch("addTodo", "Your New Todo", false);

Why

Less boilerplate when creating Stores and a more fluent API for doing so.

Plans

This is a thought experiment, and there are plans for versions that allow for using RxJS or move in the direction of things like Cycle and Yolk.

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago