New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

restatement

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restatement

remote state management for front-end applications

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

restatement

remote state management for frontend applications.

Features

  • Typed API
  • Zero dependencies
  • Flexible implementation

Usage

Setup all the shared pieces:

  • Cache to store all the remote state
  • PubSub to notify the query instances that the value has changed.

and make a new RemoteStateQuery() for all the queries that can be cached.

Example

const cacheStore = new CacheStore();
const stateProvider = new PubSub();


async function getUserInfo() { /* ... */ }

// in component UserInfo
const queryA = new RemoteStateQuery({ cacheStore, stateProvider, queryFn: getUserInfo });

// in component ShoppingCart
const queryB = new RemoteStateQuery({ cacheStore, stateProvider, queryFn: getUserInfo });

This will result in only 1 query being executed, since the queryA will cache the value returned by the getUserInfo, making queryB return the most recent value from the cache.

Development

Clone the repo and run pnpm install.

Testing

To run the tests, use the package script test or test --coverage for code coverage.

Building

To build the js files, run build:js and build:type for typescript declaration files.

For a full build (.d.ts, .js), run the build script.

License

MIT License

Keywords

state

FAQs

Package last updated on 30 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts