Add renderFrames callbag

This commit is contained in:
Tangent Wantwight 2020-02-15 21:10:19 -05:00
parent 5e29841717
commit c77499a577
3 changed files with 34 additions and 4 deletions

25
package-lock.json generated
View file

@ -1578,6 +1578,31 @@
"resolved": "https://registry.npmjs.org/callbag/-/callbag-1.2.0.tgz", "resolved": "https://registry.npmjs.org/callbag/-/callbag-1.2.0.tgz",
"integrity": "sha512-RMcVOk2oyA8CyCt/HsLEvnvvttKlaGVaG0uOo5IY7RpdiPLhStjxv5oYre33VJfT8kJE+cuKLSNHooz7yCUdhQ==" "integrity": "sha512-RMcVOk2oyA8CyCt/HsLEvnvvttKlaGVaG0uOo5IY7RpdiPLhStjxv5oYre33VJfT8kJE+cuKLSNHooz7yCUdhQ=="
}, },
"callbag-animation-frames": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/callbag-animation-frames/-/callbag-animation-frames-2.1.0.tgz",
"integrity": "sha512-mRvpE47uySluq2ioOVMY1fqS//6bxuiok8hNEMdPwa2JPYBJIQxkdpTpOXuAzyfxd+U1Yysp3I37PrnaH0ziPg==",
"requires": {
"callbag": "^1.1.0",
"callbag-share": "^1.1.1"
}
},
"callbag-map": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/callbag-map/-/callbag-map-1.1.0.tgz",
"integrity": "sha512-/xFzvJCtx1xulZpFeI4wq+ZD7tkg417XOeJ3wS9v8bHLLpt+fHKXgbZ8TBnnIxywJN6Uu/ZhL+c1DzUG6KXYFQ==",
"requires": {
"callbag": "^1.1.0"
}
},
"callbag-share": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/callbag-share/-/callbag-share-1.2.0.tgz",
"integrity": "sha512-Gt+D5lfJ/j3X5/3PiMPL8hHDPBmeQILZl2QYu+YJtSFz6PlNGQSL45aD4e4uoxMvhMZY9NpMHh7KRWia9PZA+g==",
"requires": {
"callbag": "^1.1.0"
}
},
"caller-callsite": { "caller-callsite": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",

View file

@ -18,6 +18,8 @@
"typescript": "^3.7.3" "typescript": "^3.7.3"
}, },
"dependencies": { "dependencies": {
"callbag": "^1.2.0" "callbag": "^1.2.0",
"callbag-animation-frames": "^2.1.0",
"callbag-map": "^1.1.0"
} }
} }

View file

@ -1,5 +1,7 @@
import { Callbag } from "callbag"; import { Callbag } from "callbag";
import animationFrames from "callbag-animation-frames";
import map from "callbag-map";
import { INPUT_FREQUENCY, LockstepProcessor, LockstepState } from "../Ecs/Lockstep"; import { INPUT_FREQUENCY, LockstepProcessor, LockstepState } from "../Ecs/Lockstep";
@ -82,4 +84,5 @@ export abstract class LockstepClient<Input, State> {
}; };
} }
public renderFrames = map((ms: number) => this.state.getStateToRender())(animationFrames);
} }