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

@mnjs/data

v5.1.1

Published

Observable Model and Collection sources for Marionette

Readme

@mnjs/data

Observable Model and ordered Collection sources for Marionette v5. This package uses @mnjs/utils and works without Marionette core or a DOM. Its nonoptional Utils peer is ^5.0.1, so Data does not need an identical core version. Share one Utils instance across core, Radio, and Data: their event graph must not mix separately installed copies.

It is a workable but incomplete application data layer. Supply fetching, persistence, validation, and server synchronization through an API layer, or use another data solution with a compatible Marionette provider. Models and Collections do not include fetch, save, or HTTP deletion methods.

Standalone use

Install Data; modern npm supplies its nonoptional Utils peer automatically. With core already installed, its matching Utils satisfies the peer:

npm install --ignore-scripts --save-exact @mnjs/[email protected]
import { Collection, Model } from '@mnjs/data';

const item = new Model({ id: 'a', title: 'First item' });
const items = new Collection([item]);

item.on('change:title', (model, title) => console.log(title));
item.set('title', 'Updated item');
items.add({ id: 'b', title: 'Second item' });
items.toArray(); // Shallow attribute copies for serialization.

Attribute mutations publish synchronous change events. Collection membership and order changes publish structural events. Existing Models retain their identity; raw attribute objects construct Models. reset replaces membership, while add, remove, move, and updates to existing Models preserve retained members.

destroy() ends the local event lifetime. Destroying a Collection releases its subscriptions without destroying its Models. Removing an item from a Collection also leaves the Model alive.

Marionette integration

For a new application, add core and its matching Radio package:

npm install --ignore-scripts --save-exact [email protected] @mnjs/[email protected]

Configure providers before constructing consumers:

import { setDataApi, setStateApi } from 'marionette';
import { DataApi, StateApi } from '@mnjs/data';

setDataApi(DataApi);
setStateApi(StateApi);

DataApi connects Models and Collections to Views and CollectionViews. StateApi connects observable state and its ownership lifecycle. Rendering is configured separately. Views borrow their data; state returned by createState is owned.

Version-matched reference

The matching marionette package includes the canonical reference. If you have installed it, open these files from your project directory:

  • node_modules/marionette/docs/packages/data.md: all Model/Collection methods, configuration, events, identity, disposal, and exported TypeScript types.
  • node_modules/marionette/docs/integrations/setup.md: renderer and provider setup.
  • node_modules/marionette/docs/api/providers/data.md: integration contracts for native and alternative data solutions.

Standalone use of @mnjs/data does not require core. General project information is available on the Marionette website.