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

literium-runner

v0.2.2

Published

Runner module for Literium web-framework.

Readme

Literium Web-application runner

npm version npm downloads Build Status

This project is part of Literium WEB-framework.

Usage

The runner includes some independent parts which can be used to run your application. The application must be implemented as a component. Same components can be run both on client to interact with user or on server to build HTML pages.

Component runner

Client

export interface Run<State, Event> {
    (app: Component<State, Event>, elm?: Node): void;
}

function init<State, Event>(doc: Document = document): Run<State, Event>;

The proper way to run your app on client is like so:

// import polyfills

// import runner parts (initializer)
import { init } from 'literium-runner/es/client';

// import application component (initializer)
import { main } from './main';

// initialize runner
const run = init();

// initialize app
const app = main();

// run app using runner on whole document (full-page app)
run(app);

// run app using runner on a body node
run(app, document.body);

Additional parts

Depending on your needs you does or doesn't use additional parts.

Base URL

The first thing that we would like to determine before application runs is a base URL.

Usually Web-applications available from root of Web-site, so related-links, resources and requests can use the protocol and domain as base URL.

To get base URL you can use getBase() as described in examples below.

On client (uses Location object of window):

import { getBase } from 'literium-runner/es/client';

getBase(window) // => "https://example.tld"

On server (uses Host header of request):

import { getBase } from 'literium-runner/server';

getBase(window) // => "http://example.tld"

Preferred language

Internationalized applications requires a way to determine preferred language from user environment.

You can get user-preferred languages using getLangs() as described below.

On client it tries to determine language from Navigator.

import { getLangs } from 'literium-runner/es/client';

getLangs(window) // => ['ru', 'en', ...]

On server it determines language using Accept-Language header of request.

import { getLangs } from 'literium-runner/server';

getLangs(request) // => ['ru', 'en', ...]

Navigation API

Modern user-agents provides advanced History API which allows client-side navigation (also known HTML5 History API). This allows us speed-up our apps by reducing direct client-server interaction (i.e. from now we won't need requesting html pages itself at all).

Navigation API provided by literium is simple:

interface Nav<AppEvent> {
    // change path events handling
    on(fork: Fork<AppEvent>): void;
    // set local path checker
    is(fn: (path: string) => boolean): void;
    // process navigation directly
    go(url: string): void;
    // process click to link event
    ev(evt: Event): void;
}

type SetPath = Keyed<'path', string>; /* change path event */

Your application can accept SetPath event.

Set navigation event listener using on() and local path checker using is() on creating your application.

Use go() to change current path manually or ev() to process clicks on links locally.

Initializing navigation on client:

import { initNav } from 'literium-runner/es/client';

const nav = initNav(window); // => Nav<Event extends SetPath>

Initializing navigation on server:

import { initNav } from 'literium-runner/server';

const nav = initNav(request); // => Nav<Event extends SetPath>