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

ump-plugin-shared-data

v0.0.1

Published

UMP Shared Data — in-memory, observable key→JSON store shared between JS and native

Downloads

144

Readme

ump-plugin-shared-data

In-memory, observable shared key–value store across the JS layer and native host code (iOS / Android / HarmonyOS). A write on one side notifies subscribers on the other. Values are JSON-serializable; the store is process-lifetime (not persisted) — it is real-time shared state between JS and native, not a storage layer.

This is distinct from ump-plugin-storage (async, persisted KV) and localStorage (sync, persisted): those persist to disk; this one is in-memory and observable.

JS

import { SharedData } from 'ump-plugin-shared-data';

SharedData.set('user', { id: 1, name: 'a' });   // JSON.stringify + broadcast
SharedData.get('user');                          // { id: 1, name: 'a' }  (null if absent)
SharedData.keys();                               // ['user']

const off = SharedData.subscribe('user', (v) => console.log('user ->', v));
SharedData.subscribeAll((key, v) => console.log(key, '->', v));
off();                                            // unsubscribe

SharedData.remove('user');                        // subscribers fire with null
SharedData.set('user', undefined);                // top-level undefined === remove
  • Values: any JSON-serializable value (string / number / boolean / object / array / null).
  • get / set / remove / keys are synchronous.
  • A write broadcasts to all subscribers, including the side that wrote it (echo). Equal-value writes are de-duped — writing the same JSON fires nothing.
  • set throws if the value is not JSON-serializable (e.g. a cycle).

Native

Native callers exchange JSON strings (parse with the platform's JSON library). setJSON validates the string at the boundary and rejects invalid JSON without storing.

iOS (Objective-C / Swift)

#import "UMPSharedData.h"

[UMPSharedData setJSON:@"user" value:@"{\"id\":1}"];   // returns NO if invalid JSON
NSString *json = [UMPSharedData getJSON:@"user"];       // JSON string or nil
NSArray<NSString *> *ks = [UMPSharedData keys];

id token = [UMPSharedData observe:@"user" onChange:^(NSString * _Nullable json) {
    // fires on the writer's thread; hop to main for UIKit. json is nil on removal.
}];
[UMPSharedData unobserve:token];                        // idempotent

Android (Kotlin)

UMPSharedData.setJSON("user", "{\"id\":1}")   // false if invalid JSON
UMPSharedData.getJSON("user")                  // String? (null if absent)
UMPSharedData.keys()                           // Array<String>

val token = UMPSharedData.observe("user") { json ->
    // posted to the Looper captured at observe() time. json is null on removal.
}
UMPSharedData.unobserve(token)                 // idempotent

HarmonyOS (ArkTS)

import { UMPSharedData } from './UMPSharedData';

UMPSharedData.setJSON('user', '{"id":1}');     // false if invalid JSON
UMPSharedData.getJSON('user');                 // string | null
UMPSharedData.keys();                          // string[]

observe on HarmonyOS is deferred to v2 (it needs a NAPI threadsafe-function to hop the store's writer-thread callback into ArkTS). iOS and Android support observe/unobserve today.

Architecture

The store is a thread-safe singleton (ump::SharedDataStore) in runtime/core, so JS, native, and every platform reach the same data. The plugin is glue: a JSI registrar exposes __ump_shareddata_* to JS and a kSharedData event channel; per-platform helpers wrap the store's C ABI. Writes broadcast outside the store lock; JS subscribers are delivered on the JS thread via the plugin event bus; native subscribers fire on the writer's thread.

Design: docs/superpowers/specs/2026-06-04-shared-data-plugin-design.md