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

modapp

v2.7.0

Published

A thin framework for building completely modular web applications.

Readme

view on npm

ModApp

A thin framework for building modular web applications.

Installation

With npm:

npm install modapp

With yarn:

yarn add modapp

Example

import { App } from 'modapp';

// A module keeping track of greetings
class Greetings {
	constructor(app, params) {
		this.app = app;
		this.greetings = {};
	}

	addGreeting(lang, greeting) {
		this.greetings[lang] = greeting;
	}

	removeGreeting(lang) {
		delete this.greetlings[lang];
	}

	greet(lang) {
		let greeting = this.greetings[lang];
		console.log(greeting || "Unknown language");
	}

	dispose() {} // Nothing to dispose
}

// A module for swedish greetings
class EnglishGreeting {
	constructor(app, params) {
		this.app = app;
		this.greeting = params.greeting || "Hello";
		this.app.require(['greetings'], this._init.bind(this));
	}

	_init(module)  {
		this.module = module;
		this.module.greetings.addGreeting('english', this.greeting);
	}

	dispose() {
		this.module.greetings.removeGreeting('english');
	}
}

// Creating the app with some module configuration. These parameters may be overwritten using url queries
let app = new App({ englishGreeting: { greeting: "Hi" }});

// Bundles are usually created dynamically using tools like webpacks require context.
let bundle = {
	greetings: Greetings,
	englishGreeting: EnglishGreeting
};

app.loadBundle(bundle)
	.then(result => {
		console.log("Modules loaded: ", result);
		app.getModule('greetings').greet('english');
	});

Using modapp

Modules can be loaded, deactivate, and reactivated while the application is running, allowing hotloading of new features and functionality to the application. New modules will simply hook into the application using the register/unregister methods provided (addGreeting and removeGreeting in the example).

Try resgate-test-app to see modapp in use.

AppModule interface

For a class to be loaded by the app, it must follow the AppModule interface.
A module may expose any number of public methods, using camelCase as naming convention.
All properties should be considered private, as well as any methods starting with an underscore (_).
Any exposed method that allows other modules to register objects or callbacks, must come paired with a method for unregistering.

appModule.constructor(app, params)

The app module constructor.
It is only in the constructor that the module may call app.require(...). If app.require is called, the module must postpone registering any objects or callbacks until the require callback is called to prevent memory leaks in case the App cannot fulfill the requirements and discards the app module. (#AppModule)

| Param | Type | Description | | --- | --- | --- | | app | App | The app instance | | params | Object.<string, *> | Module parameters from the app config |

appModule.dispose()

Disposes the app module, removing any items or callbacks previously registered within the constructor or in the app.require callback.
Once disposed, no more calls will be done to the module instance.

Documentation

Markdown documentation