‚̧Neutrino Packing Machine
    Have ideas to improve npm?Join in the discussion! ¬Ľ

    hyperapp-middleware

    0.3.0-alpha.0¬†‚Äʬ†Public¬†‚Äʬ†Published

    Hyperapp Middleware

    Build Status Codecov npm

    A 0.7 KB utility belt to build higher-order apps (HOA) for Hyperapp v2 using middleware functions for onState, onAction, and onEffect.

    Installation

    Node.js

    Install with npm / Yarn.

    npm i hyperapp-middleware@next
    

    Then with a module bundler like rollup or webpack, use as you would anything else.

    import { withMiddleware } from "hyperapp-middleware"

    Or using require.

    const { withMiddleware } = require("hyperapp-middleware")

    Browser

    Download the minified library from the CDN.

    <script src="https://unpkg.com/hyperapp-middleware@next"></script>

    You can find the library in window.hyperappMiddleware.

    API

    withMiddleware({
      onState(nextState, prevState) {
        // prevState will be undefined for initial state
      },
      onAction(action, state, props, data) {
        // state is value before the action was processed
        // props are from the [action, props] tuple, if used
        // data is from second arg to dispatch, usually a DOM event
      },
      OnEffect(effect, state, props) {
        // state will be whatever state was included in the tuple
      }
    })(app)({
      // ... the usual suspects
    })

    License

    Hyperapp Middleware is MIT licensed. See LICENSE.

    Keywords

    none

    Install

    npm i [email protected]

    Version

    0.3.0-alpha.0

    License

    MIT

    Unpacked Size

    19.2 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar
    • avatar