本文整理汇总了TypeScript中rxjs/observable/timer.timer函数的典型用法代码示例。如果您正苦于以下问题:TypeScript timer函数的具体用法?TypeScript timer怎么用?TypeScript timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timer函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: switchMap
switchMap(([event, options, element, document]) => {
return timer(event[1] || 2000).pipe(
tap(() => {
element.style.display = "none";
if (element.parentNode) {
document.body.removeChild(element);
}
})
);
})
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:10,代码来源:log.ts
示例2: mergeMap
, mergeMap(() => {
return timer(200).pipe(
tap(() => {
// if another reattachImportedRule call is in progress, abandon this one
if (rule.__LiveReload_newHref !== href) { return; }
parent.insertRule(newRule, index);
return parent.deleteRule(index+1);
})
)
})
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:10,代码来源:Reloader.ts
示例3: playPhrase
playPhrase(start: number, duration: number) {
console.log('In video playPhrase, start=' + start + ' duration=' + duration);
// const timer = Observable.timer(duration * 1000);
const timerx = timer(100); // yield for 100 milliseconds
timerx.subscribe(t => this.api.pause());
// timer.subscribe(t=>console.log('done with timeout'));
this.api.seekTime(start);
this.api.play();
console.log('exiting video playPhrase');
}
开发者ID:govmeeting,项目名称:govmeeting,代码行数:10,代码来源:video.component.ts
示例4: reattachImportedRule
function reattachImportedRule({ rule, index, link }, document: Document): Observable<any> {
const parent = rule.parentStyleSheet;
const href = generateCacheBustUrl(rule.href);
const media = rule.media.length ? [].join.call(rule.media, ', ') : '';
const newRule = `@import url("${href}") ${media};`;
// used to detect if reattachImportedRule has been called again on the same rule
rule.__LiveReload_newHref = href;
// WORKAROUND FOR WEBKIT BUG: WebKit resets all styles if we add @import'ed
// stylesheet that hasn't been cached yet. Workaround is to pre-cache the
// stylesheet by temporarily adding it as a LINK tag.
const tempLink = document.createElement("link");
tempLink.rel = 'stylesheet';
tempLink.href = href;
tempLink.__LiveReload_pendingRemoval = true; // exclude from path matching
if (link.parentNode) {
link.parentNode.insertBefore(tempLink, link);
}
return timer(200)
.pipe(
tap(() => {
if (tempLink.parentNode) { tempLink.parentNode.removeChild(tempLink); }
// if another reattachImportedRule call is in progress, abandon this one
if (rule.__LiveReload_newHref !== href) { return; }
parent.insertRule(newRule, index);
parent.deleteRule(index+1);
// save the new rule, so that we can detect another reattachImportedRule call
rule = parent.cssRules[index];
rule.__LiveReload_newHref = href;
})
, mergeMap(() => {
return timer(200).pipe(
tap(() => {
// if another reattachImportedRule call is in progress, abandon this one
if (rule.__LiveReload_newHref !== href) { return; }
parent.insertRule(newRule, index);
return parent.deleteRule(index+1);
})
)
})
);
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:48,代码来源:Reloader.ts
示例5: switchMap
switchMap(() => {
return concat(of(false), timer(timeout).pipe(mapTo(true)));
}),
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:3,代码来源:utils.ts
示例6: return
return (c: AbstractControl) => { return map.call(timer(time), () => errorMap); };
开发者ID:lucidsoftware,项目名称:angular,代码行数:1,代码来源:validators_spec.ts
示例7: timer
(() => {
console.log("Starting count down:");
timer(0, 1000).pipe(map(n => 5 - n), take(6)).subscribe(n => console.log(n));
}); //();
开发者ID:,项目名称:,代码行数:4,代码来源:
示例8: spyOn
spyOn(translate.currentLoader, 'getTranslation').and.callFake(() => {
getTranslationCalls += 1;
return timer(1000).pipe(mapTo(of(translations)));
});
开发者ID:jupereira0920,项目名称:core,代码行数:4,代码来源:translate.service.spec.ts
示例9: mergeMap
mergeMap(i => timer(i * ms))
开发者ID:cironunes,项目名称:angular,代码行数:1,代码来源:backoff.ts
注:本文中的rxjs/observable/timer.timer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论