This package has been deprecated

Author message:

this library is renamed to flux-emitter

caliburne

0.2.0 • Public • Published

Caliburne

Description

This library is a mizchi/flumpt porting for dekujs/deku.

Source code for this library is based from mizchi/flumpt, and flumpt is under the MIT-license.

Example

/** @jsx element */
 
import { element, dom } from 'deku';
import caliburne from '../src/caliburne';
 
const { createRenderer } = dom;
 
const ButtonClickr = {
  render({ props, children, dispatch }) {
    const onClick = () => {
      dispatch('increment');
    };
 
    return (
      <div>
        <p>{props.count.toString()}</p>
        <p><button onClick={onClick}>Click!</button></p>
      </div>
    );
  },
};
 
const initialState = { count: 0 };
const context      = caliburne(initialState, [
  (state) => {
    console.log(state);
    return state;
  }
]);
 
context.on('increment', () => {
  context.update(({ count }) => {
    return { count: count + 1 };
  })
});
 
const render = createRenderer(document.querySelector('main'), context.dispatch);
 
context.on(':apply-updating', (state) => {
  render(<ButtonClickr {...state} />, context);
});

Middlewares

Middleware archtecture is (maybe) same as flumpt's middlewares.

TypeScript?

I have no skills for TypeScript.

So, THIS LIBRARY IS NOT INCLUDES .d.ts FILE.

Author

Original implementation is writte by mizchi and that library is under the MIT-license.

This library is written by Naoki OKAMURA (Nyarla) nyarla@thotep.net

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i caliburne

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • nyarla