Skip to content
Myr

classless

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by Michel Weststrate · parent 7b13028 · Browse files · 1 file+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−9 removed

  • other:+9 added−9 removed

1 file+9 added−9 removed

modified:src/immer.js+9 added-9 removed
33 unmodified lines
34 return objectTraps[key].apply(this, arguments)35 }36}3738class State {39 constructor(parent, base) {40 this.modified = false41 this.finalized = false42 this.parent = parent43 this.base = base44 this.copy = undefined45 this.proxies = {}38function createState(parent, base) {39 return {40 modified: false,41 finalized: false,42 parent,43 base,44 copy: undefined,45 proxies: {}46 }47}4849function source(state) {
63 unmodified lines
113}114115// creates a proxy for plain objects / arrays116function createProxy(parentState, base) {117 const state = new State(parentState, base)117 const state = createState(parentState, base)118 let proxy119 if (Array.isArray(base)) {120 proxy = Proxy.revocable([state], arrayTraps)121 } else {
139 unmodified lines