Socket
Socket
Sign inDemoInstall

mobx-utils

Package Overview
Dependencies
Maintainers
4
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-utils - npm Package Versions

1
46

3.2.0-rc.1

Diff

mweststrate
published 3.1.1 •

Changelog

Source

3.1.1

  • Introduced whenAsync, which is like normal when, except that this when will return a promise that resolves when the expression becomes truthy. See #66 and #68, by @daedalus28
mweststrate
published 3.0.0 •

Changelog

Source

3.0.0

Revamped fromPromise:

  • It is now possible to directly pass a (resolve, reject) => {} function to fromPromise, instead of a promise object
  • BREAKING fromPromise no longer creates a wrapping object, but rather extends the given promise, #45
  • BREAKING Fixed #54, the resolved value of a promise is no longer deeply converted to an observable
  • BREAKING Dropped fromPromise().reason
  • BREAKING Improved typings of fromPromise. For example, the value property is now only available if .state === "resolved" (#41)
  • BREAKING Dropped optional initialvalue param from fromPromise. use fromPromise.fulfilled(value) instead to create a promise in some ready state
  • Introduced fromPromise.reject(reason) and fromPromise.resolve(value?) to create a promise based observable in a certain state, see #39
  • Fixed #56, observable promises attributes state and value are now explicit observables

Introduced asyncAction

See the docs for details, but the gist of it:

import {asyncAction} from "mobx-utils"

mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions

class Store {
	@observable githubProjects = []
	@state = "pending" // "pending" / "done" / "error"

	@asyncAction
	*fetchProjects() { // <- note the star, this a generator function!
		this.githubProjects = []
		this.state = "pending"
		try {
			const projects = yield fetchGithubProjectsSomehow() // yield instead of await
			const filteredProjects = somePreprocessing(projects)
			// the asynchronous blocks will automatically be wrapped actions
			this.state = "done"
			this.githubProjects = filteredProjects
		} catch (error) {
			this.state = "error"
		}
	}
}

Other

  • Fixed #40, now() now returns current date time if invoked from outside a reactive context
mweststrate
published 2.0.2 •

Changelog

Source

2.0.2

  • Fixed #44, lazyObservable not accepting an array as initial value.
  • ViewModel methods are now automatically bound, see #59, by @tekacs
  • Fixed stream issue regarding disposing already completed streams, see #57, by @rkorohu
  • Improved typings of lazy observables, see #38 by @jamiewinder
mweststrate
published 2.0.1 •

Changelog

Source

2.0.1

  • Fixed several deprecation messages related to MobX 3 upgrade (see #36 by RainerAtSpirit)
  • Fixed #26: Rejected promises not playing nicely with JQuery
  • Fixed #25: Refreshing a lazy observable should not accidentally refresh it if it didn't start yet
mweststrate
published 2.0.0-fix26 •

mweststrate
published 2.0.0 •

Changelog

Source

2.0.0

  • Upgraded to MobX 3
mweststrate
published 1.1.6 •

Changelog

Source

1.1.6

  • Fixed #34: fromStream threw when being used in strict mode
  • Introduced reset() on lazyObservable, see #28 by @daitr92
mweststrate
published 1.1.5 •

Changelog

Source

1.1.5

  • Fixed #32: make sure lazyObservable and fromResources can be initiated from computed values
mweststrate
published 1.1.4 •

Changelog

Source

1.1.4

  • Introduced now(interval?), to get an observable that returns the current time at a specified interval
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc