##// END OF EJS Templates
Added tag v1.9.0-rc5 for changeset 894b8239b953
Added tag v1.9.0-rc5 for changeset 894b8239b953

File last commit:

r133:a3fba6b6c42e default
r143:62b21ca84dce default
Show More
state-tests.ts
28 lines | 599 B | video/mp2t | TypeScriptLexer
/ djx / src / test / ts / state-tests.ts
cin
added 'buffer' and 'subject' observable operators
r133 import { observe } from "./observable";
import { buffer } from "./operators/buffer";
cin
added while, until methods to the observable interface....
r124 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;
cin
added 'buffer' and 'subject' observable operators
r133 const obs = observe<CounterState>(({ next }) => {
cin
added while, until methods to the observable interface....
r124 next(initial);
set = next;
cin
added 'buffer' and 'subject' observable operators
r133 }).pipe(buffer(2));
cin
added while, until methods to the observable interface....
r124
set({ count: 10, label: "mid" });
obs.subscribe({
next: v => value = v
});
t.equal(value.count, 10, "State should update");
set({ count: 20, label: "high" });