Catalog npm
Back to packageRELEASE DETAILS

0.0.2

npm

0flux

Typed state management

Published5 Dec 2015
Direct dependencies0
Transitive dependenciesNot calculated

README

Current package documentation

Ø Flux

A small, typed state management library.

Example:

'use strict';

import * as Flux from '0flux';

interface TodoAction {
  name: string;
  id: number;
}

const container = new Flux();

const dispatcher = {
  addTodo: container.action<TodoAction>(),
  removeTodo: container.action<TodoAction>(),
};

interface State {
  todos: TodoAction[];
}

const todoState = container.state<State>((getState, setState) => {
  dispatcher.addTodo.bind((todoAction) => {
    setState({
      todos: getState().todos.concat([ todoAction ])
    });
  });

  dispatcher.removeTodo.bind((todoAction) => {
    setState({
      todos: getState().todos.filter((item) => {
        return item.id !== todoAction.id;
      })
    });
  });

  return {
    todos: []
  };
});

const julia = dispatcher.addTodo.dispatch({
  id: 0,
  name: 'julia'
});

const clone = dispatcher.addTodo.dispatch({
  id: 1,
  name: 'evil julia clone'
});

console.log('evil clone detected:');
console.log(todoState.current);

dispatcher.removeTodo.dispatch(clone);

console.log('evil clone eliminated:');
console.log(todoState.current);

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "488ea61763f0cfc219336918e23df2ad6559ae51",
  "tarball": "https://registry.npmjs.org/0flux/-/0flux-0.0.2.tgz",
  "integrity": "sha512-aIDkNLDq84CFG/a3zJKuHp1JKXzIpkRWiit++ZhVqMkfgVuzudrMlvYQLpyar88hs6ItOyrbh+WqfqHEl1zTLA==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIBj0GEy/KBdq3hVsDrSpgA0fY/qUq2NLCLmemQT3WBrHAiAWa7GeD4P/qxwdar2IPfSeA/xa0T/a7uV/cB+SEvfMuw=="
    }
  ]
}

Repository

PENDING
reissbaker/0flux

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:5c1ac26cbb9d8e0b0935e6abddbb7a0e137ff8a094daa81ac9f55c229713d8ba

Other collected versions

0.0.47 Dec0.0.35 Dec0.0.15 DecView all collected versions →