New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sinux

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinux

Facebook Flux architecture implementation based on self dispatching actions and commands

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Sinux

Sinux is a Facebook Flux architecture implementation inspired by signal-as3 and SignalMapCommand extension for Robotlegs. Sinux use co library

npm version npm downloads Join the chat at https://gitter.im/jbpin/sinux

Documentation

Visit the book, Sinux, a flux implementation based on signal to see the documentation and examples.

Philosophy behind Sinux

Read this article on Medium

Installation

Sinux is available on NPM

npm i sinux
yarn add sinux

Usage

Since version 0.2.0 Command objects are deprecated. Command are simple javascript function that can return a result or a function (see async below).

Using babel6 with es2015

import { Store } from sinux

const store = new Store({ initialState: true }, 'action','action2');

store.action.add( (state, ...args) => {...state, ...args} );

store.action({ foo:'bar' }).then( () => console.log( store.getState() ) );
// {initialState: true, foo: 'bar'}

Using ES3


var sinux = require('sinux');

var Store = sinux.Store;

var store = new Store({ initialState: true }, 'action','action2');

store.action.add( function (state) {
  // Array.prototype.slice.call(arguments,1)
  // ...
});

store.action({ foo:'bar' }).then(function () {
  console.log(store.getState())
});

Asynchronous command

// using generator function
store.action.add( (state, ...args) => {
  return function *(){
    let r = yield store.action2(...args)
    return r
  }()
});

// using Promise
store.action.add( (state, ...args) => {
  return new Promise((resolve, reject) => {
    setTimeout(()=> resolve(...args), 1000)
  })
})

Exemple using Sinux with React Native

Here is a simple todo app made with Sinux and React Native. todoStore.load show how to do asynchronous call View source

License

MIT

Keywords

flux

FAQs

Package last updated on 30 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts