本文整理汇总了TypeScript中kefir.fromNodeCallback函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fromNodeCallback函数的具体用法?TypeScript fromNodeCallback怎么用?TypeScript fromNodeCallback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fromNodeCallback函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: default
export default (target: string): Stream<string[], Error> =>
// @TODO(mAAdhaTTah) fix fromNodeCallback upstream
Kefir.fromNodeCallback(cb => glob(target, cb as any));
示例2: Date
let start = +new Date();
let stream05: Stream<number, void> = Kefir.fromPoll(1000, () => +new Date() - start);
}
{
let start = +new Date();
let stream06: Stream<number, void> = Kefir.withInterval<number, void>(1000, function(emitter) {
var time = +new Date() - start;
if (time < 4000) {
emitter.emit(time);
} else {
emitter.end();
}
});
}
let stream07: Stream<number, void> = Kefir.fromCallback<number>(callback => setTimeout(() => callback(1), 1000));
let stream08: Stream<number, void> = Kefir.fromNodeCallback<number, void>(callback => setTimeout(() => callback(null, 1), 1000));
let stream09: Stream<MouseEvent, void> = Kefir.fromEvents<MouseEvent, void>(document.body, 'click');
let stream10: Stream<number, void> = Kefir.stream<number, void>(emitter => {
let count = 0;
emitter.emit(count);
let intervalId = setInterval(() => {
count++;
if (count < 4) {
emitter.emit(count);
} else {
emitter.end();
}
}, 1000);
return () => clearInterval(intervalId);
示例3:
return this.compiler().flatMap(compiler =>
Kefir.fromNodeCallback(callback => compiler.run(callback))