npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hyperapp-loadable

v0.0.7

Published

Experimental package to provide react-loadable like behavior to hyperapp

Downloads

25

Readme

hyperapp-loadable

WIP This package is inspired be react-loadable. The main difference between the two packages is that this package targets hyperapp instead of react and thus does not have stateful components.

To work around this difference we use a mixin to provide a { loadable: {} } in the state as well as add actions: { loadable: { loaded: () => any }} for triggering an update/re-render after the lazy-loaded module is available.

/* src/Test.js */
import { h } from "hyperapp";

export function Test(props) {
  return (
    <div>{"Testing lazy-loaded component!"}</div>
  );
}
import { h, app } from "hyperapp";
import { loadable, Loadable, load } from "hyperapp-loadable";

const Loading = (props) => <div>{`Loading... look at my ${props}`}</div>;

app({
  view: (state, actions) => {
    return (
      <Loadable 
        loaded={actions.loadable.loaded} // *REQUIRED
        loadable={state.loadable} // *REQUIRED
        name={"/Test"} // *REQUIRED unique key for the result of loader to be stored under state.loadable[name]
        loader={() => import("./Test")} // *REQUIRED thunk which returns a promise that resolves to a component
        loaderProps={({ state: state, actions: actions })} // Optional, but useful...
        loading={Loading} // *REQUIRED component to display while loading the above loader thunk...
        loadingProps={({ foo: "bar" })} // Optional, will be passed into your Loading component for render
        defaultTime={200} // Optional default 200ms time spent displaying loading
        terminalTime={3000} // Optional default 3 second error timeout
        errorHandler={ // Optional could be used to clear cache and retry on failures etc...
          ({ name, result }) => console.error(`Loadable: ${name}, error: ${result}`)
        }
      />
    );
  },
  mixins: [loadable]
});
  • NOTE on SSR
/* SSR needs a few things special for this to all work from within nodejs...
   - you will need to add babel-plugin-dynamic-import-node to your babel config for your server bundle
   - const defaultTime = isServer() ? -1 : 200;
     const terminalTime = isServer() ? -1 : 3000;
     set default timeouts to -1 so that setTimeout's do not trigger in your server side renders...
   - be sure to load() all your components needed for a route prior to calling app({...}) then it will   all just work, YMMV

   // example of isServer used in above SSR setup...
   const isServer() => {
     return (
      typeof process !== "undefined" &&
      process.release != null &&
      (process.release.name.search(/node|io.js/) !== -1 ||
        typeof process.versions.node !== "undefined")
    );
   }
*/

License

hyperapp-loadable is MIT licensed. See LICENSE.