Skip to content

Instantly share code, notes, and snippets.

@mattmccray
Created July 28, 2015 18:27
Show Gist options
  • Save mattmccray/c5b6c69c1653b941ccd7 to your computer and use it in GitHub Desktop.
Save mattmccray/c5b6c69c1653b941ccd7 to your computer and use it in GitHub Desktop.
Immobservable?
import mobservable from 'mobservable/immutable' // Separate module needed?
// Not sure, but basically we need
// to mark it as immutable somehow
let user = mobservable.fromJson({
name: 'Matt',
age: 'NunYoBiznis'
})
user.name //= 'Matt'
user.name = 'Matthew' // ignored
user.name //= 'Matt'
mobservable.transaction(() => {
user.name = 'Matthew' // applied
user.name //= 'Matthew'
})
@mweststrate
Copy link

👍
See: mobxjs/mobx#9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment