Merge commit '63eb912434' into notes-and-numbers
This commit is contained in:
commit
9b3f77f4f5
29 changed files with 22191 additions and 20121 deletions
|
|
@ -183,7 +183,7 @@ class Hap {
|
|||
this.context = context
|
||||
this.stateful = stateful
|
||||
if (stateful) {
|
||||
assert(typeof this.value === "function", "Stateful values must be functions");
|
||||
console.assert(typeof this.value === "function", "Stateful values must be functions");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,9 +206,10 @@ class Hap {
|
|||
|
||||
resolveState(state) {
|
||||
if (this.stateful && this.hasOnset()) {
|
||||
console.log("stateful")
|
||||
const func = this.value
|
||||
[newState, newValue] = func(state)
|
||||
return [newState, this.withValue(() => newValue)]
|
||||
const [newState, newValue] = func(state)
|
||||
return [newState, new Hap(this.whole, this.part, newValue, this.context, false)]
|
||||
}
|
||||
return [state, this]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue