@shish2k/hyperapp-survive-hmr

    2.0.0 • 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

    Keywords

    Install

    npm i @shish2k/hyperapp-survive-hmr

    DownloadsWeekly Downloads

    13

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    8.23 kB

    Total Files

    8

    Last publish

    Collaborators

    • shish2k