本文整理匯總了TypeScript中@funkia/jabz.fgo函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript fgo函數的具體用法?TypeScript fgo怎麽用?TypeScript fgo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了fgo函數的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("can be tested", () => {
let requests: number[] = [];
const model = fgo(function*({ click }) {
const request = click.mapTo(
withEffects((n: number) => {
requests.push(n);
return n + 2;
})
);
const response = yield H.performStreamLatest(request);
const res = H.stepperFrom("", response.map((e) => e.toString()));
return { res };
});
const click = testStreamFromObject({ 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 });
const out: { res: Behavior<Behavior<string>> } = testNow(
model({ click }),
[testStreamFromObject({ 0: "old", 1: "old", 2: "response" })]
);
assert(H.isBehavior(out.res));
assert.equal(
out.res
.model()(0)
.model()(4),
"response"
);
assert.deepEqual(requests, []);
});