Skip to content

Instantly share code, notes, and snippets.

@ssube
Created March 22, 2017 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssube/aac98303acda7d3c309217c84d26cb1c to your computer and use it in GitHub Desktop.
Save ssube/aac98303acda7d3c309217c84d26cb1c to your computer and use it in GitHub Desktop.
this._interval = Observable.interval(1000 / 20).timeInterval();
this._screen.realloc();
let state = 0;
const bufferInput = this._input.getStream().buffer(this._interval);
const frames: Observable<Frame> = this._interval.combineLatest(bufferInput).map((value) => {
return {
actions: value[1],
time: value[0]
};
});
frames.subscribe((frame) => {
this._log.debug({frame}, 'frame tick');
let next = false;
let prev = false;
for (const action of frame.actions) {
switch (action.command) {
case Command.BaseMenu:
complete();
// ...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment