##// END OF EJS Templates
bump dependencies, bump ts to 5.2...
bump dependencies, bump ts to 5.2 moved observables logic to ObservableImpl fixed while/until bug with complete handler multiple call

File last commit:

r133:a3fba6b6c42e default
r155:6acbe6efbe20 v1.10.2 default
Show More
state-tests.ts
28 lines | 599 B | video/mp2t | TypeScriptLexer
import { observe } from "./observable";
import { buffer } from "./operators/buffer";
import * as t from "tap";
interface CounterState {
count: number;
label: "low" | "mid" | "high"
}
let set: (v: CounterState) => void = () => void (0);
const initial: CounterState = { count: 0, label: "low" };
let value = initial;
const obs = observe<CounterState>(({ next }) => {
next(initial);
set = next;
}).pipe(buffer(2));
set({ count: 10, label: "mid" });
obs.subscribe({
next: v => value = v
});
t.equal(value.count, 10, "State should update");
set({ count: 20, label: "high" });