@brandingbrand/cargo-hold-devtools
TypeScript icon, indicating that this package has built-in type declarations

11.88.1 • Public • Published

Cargo Hold Devtools

Based on NgRx Store Devtools

Usage

import {
  Store,
  combineActionReducers,
  createActionCreator,
  matches,
  on,
} from '@brandingbrand/cargo-hold';
import { addDevtools } from '@brandingbrand/cargo-hold-devtools';

// Create Store as normal
const store = new Store({ count: 0 });

// Add Devtools after creating Store
addDevtools(store);

/**
 * Use Cargo Hold
 */
const add = createActionCreator({
  actionKey: 'add',
});

const subtract = createActionCreator({
  actionKey: 'subtract',
});

store.registerReducer(
  combineActionReducers(
    on(matches(add), () => ({ count }) => ({ count: count + 1 })),
    on(matches(subtract), () => ({ count }) => ({ count: count - 1 }))
  )
);

store.dispatch(add.create());
store.dispatch(add.create());
store.dispatch(subtract.create());
store.dispatch(subtract.create());
store.dispatch(add.create());

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @brandingbrand/cargo-hold-devtools

      Weekly Downloads

      1

      Version

      11.88.1

      License

      MIT

      Unpacked Size

      94.9 kB

      Total Files

      33

      Last publish

      Collaborators

      • bbtravisreadonly
      • tom_thornton
      • philtompkins
      • nathan-sankbeil
      • chrisjlan89branding
      • branderbrett
      • skyeckstrom
      • nickburkhartbb
      • bbtravis
      • deemaabdallah
      • msiauko
      • jasonmosleybb
      • dshadrick
      • nickbb
      • notajvento
      • andyschwob
      • xero
      • varzamanbb
      • bb_jenkins
      • crherman7
      • wsedlacekc
      • ckornell
      • jmwr
      • mjweb48