separate out strudel.mjs, make index.mjs aggregate module
This commit is contained in:
parent
0396c3f475
commit
f75da0e2e3
21 changed files with 296 additions and 329 deletions
22
packages/core/state.mjs
Normal file
22
packages/core/state.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export class State {
|
||||
constructor(span, controls = {}) {
|
||||
this.span = span;
|
||||
this.controls = controls;
|
||||
}
|
||||
|
||||
// Returns new State with different span
|
||||
setSpan(span) {
|
||||
return new State(span, this.controls);
|
||||
}
|
||||
|
||||
withSpan(func) {
|
||||
return this.setSpan(func(this.span));
|
||||
}
|
||||
|
||||
// Returns new State with different controls
|
||||
setControls(controls) {
|
||||
return new State(this.span, controls);
|
||||
}
|
||||
}
|
||||
|
||||
export default State;
|
||||
Loading…
Add table
Add a link
Reference in a new issue