0.0.7 • Published 4 years ago

mobx-init-on-demand v0.0.7

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

mobx-init-on-demand

npm, github

Initialize large mobx objects on read, instead of on creation. For extremely large objects, this defers the performance cost of wrapping objects in mobx containers until they are actually needed.

Usage

yarn add mobx-init-on-demand

import { observableOnDemand } from 'mobx-init-on-demand';

const myObservable = observableOnDemand({
    ... // your large object here
})

// use the observable as normal
autorun(() => {
  console.log(myObservable.some.deep.nested.prop)
})

Development

yarn # install dependencies
yarn build # build.             Can also use `rollup -c`
yarn watch # build with watch.  Can also use `rollup -cw`
yarn jest # run tests

run an integration test against an open-source repo. see ./integration-test for more details.

REPO="https://github.com/microsoft/satcheljs.git" ./integration-test/scripts/run-mobx-test.sh yarn jest

# or for testing failing tests

REPO="https://github.com/microsoft/satcheljs.git" ./integration-test/scripts/run-mobx-test.sh yarn jest --watch
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago