Socket
Socket
Sign inDemoInstall

@machinat/dev-state

Package Overview
Dependencies
9
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @machinat/dev-state

This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html) with in-memory and file storage. We suggest to use them for testing purpose only.


Version published
Weekly downloads
2
Maintainers
2
Install size
73.7 kB
Created
Weekly downloads
 

Readme

Source

Dev State Module

This module implement the BaseStateController with in-memory and file storage. We suggest to use them for testing purpose only.

Install

npm install @machinat/core @machinat/dev-state
# or with yarn
yarn add @machinat/core @machinat/dev-state

Docs

Check the Using State document for the usage guide, and the package reference for API details.

Setup

In-Memory State
import Machinat from '@machinat/core';
import { InMemoryState } from '@machinat/dev-state';

const app = Machinat.createApp({
  modules: [
    InMemoryState.initModule(),
  ],
});
File State
import Machinat from '@machinat/core';
import { FileState } from '@machinat/dev-state';
import YAML from 'yaml';

const app = Machinat.createApp({
  modules: [
    FileState.initModule({
      path: './.state_storage.json',
    }),
  ],
  services: [
    // you can swap the serializer
    { provide: FileState.Serializer, withValue: YAML }
  ],
});

FAQs

Last updated on 16 Jan 2022

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