Socket
Socket
Sign inDemoInstall

fragstore-logger

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fragstore-logger

Logger for fragstore


Version published
Maintainers
1
Install size
5.89 kB
Created

Readme

Source

Fragstore Logger

A simple and minimal logger for Fragstore state management library.

How to use?

import createStore from 'fragstore';
import logger from 'fragstore-logger';

const initialStore = {
  name: 'Sid',
  age: 21
};

const { useStore } = createStore(initialStore, logger);

If you want to use more than one afterUpdate listeners for fragstore:

import createStore from 'fragstore';
import logger from 'fragstore-logger';

const initialStore = {
  name: 'Sid',
  age: 21
};

function onAfterUpdate({ path, value, prevValue, getStore }) {
  // do something here
}

// this function will run all the update listeners
const combine = (...functions) => (args) => {
  functions.forEach(fn => {
    fn(args);
  });
}

const { useStore } = createStore(initialStore, combine(onAfterUpdate, logger));

Keywords

FAQs

Last updated on 04 Nov 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc