當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript timer.timer函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。