Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@machinat/local-state

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@machinat/local-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.

latest
Source
npmnpm
Version
0.5.0-beta.18
Version published
Weekly downloads
0
-100%
Maintainers
2
Weekly downloads
 
Created
Source

Local 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/local-state
# or with yarn
yarn add @machinat/core @machinat/local-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/local-state';

const app = Machinat.createApp({
  modules: [
    InMemoryState.initModule(),
  ],
});

In-Memory State

import Machinat from '@machinat/core';
import { FileState } from '@machinat/local-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

Package last updated on 31 Dec 2021

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