Skip to content

invrs/industry-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IndustryState Build Status

Immutable state for your factories.

Requirements

This extension requires that the factory function returns a stateful object.

Usage

import { factory } from "industry"
import { functions } from "industry-functions"
import { instance } from "industry-instance"
import { standard_io } from "industry-standard-io"
import { state } from "industry-state"

class Test {
  init() {
    this.state({ a: 1 })
  }

  a({ state: { a } }) {
    return a
  }
}

let test = factory(Test)
  .set("functions", functions)
  .set("instance", instance)
  .set("state", state)
  .set("standard_io", standard_io)

test({ b: 2 })
test().state() // { a: 1, b: 2 }
test.a() // { value: 1 }

About

Immutable state for your factories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published