@shish2k/hyperapp-survive-hmr
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

HyperApp Survive HMR

A handy function to save app state before a reload and load state after it

Given a basic app like:

app({
    init: [
        state,
        FetchInitData(),
    ],
    ...
});

We can add HMR support like:

import { SurviveHMR } from "@shish2k/hyperapp-survive-hmr";

app({
    init: [
        state,
        SurviveHMR(module, [
            FetchInitData(),
        ]),
    ],
    ...
});

Notably instead of running a bunch of effects as part of init, we only run SuriveHMR, and we allow it to run extra effects as-needed

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i @shish2k/hyperapp-survive-hmr

    Weekly Downloads

    0

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    16.5 kB

    Total Files

    12

    Last publish

    Collaborators

    • shish2k