• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript empty.empty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中rxjs/observable/empty.empty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript empty函数的具体用法?TypeScript empty怎么用?TypeScript empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了empty函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: initWindowName

export function initWindowName(window: Window) {
    const saved = (() => {
        /**
         * On page load, check window.name for an existing
         * BS json blob & parse it.
         */
        try {
            return parseFromString(window.name);
        } catch (e) {
            return {};
        }
    })();

    /**
     * Remove any existing BS json from window.name
     * to ensure we don't interfere with any other
     * libs who may be using it.
     */
    window.name = window.name.replace(regex, "");

    /**
     * If the JSON was parsed correctly, try to
     * find a scroll property and restore it.
     */
    if (saved && saved.bs && saved.bs.hardReload && saved.bs.scroll) {
        const { x, y } = saved.bs.scroll;
        return of<any>(
            setScroll(x, y),
            Log.consoleDebug(`[ScrollRestore] x = ${x} y = ${y}`)
        );
    }
    return empty();
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:33,代码来源:scroll-restore.ts


示例2: switchMap

        switchMap(scroll => {
            if (!scroll) return empty();
            return fromEvent(document, "scroll", true).pipe(
                map((e: Event) => e.target),
                withLatestFrom(canSync$, elemMap$),
                filter(([, canSync]) => Boolean(canSync)),
                map(([target, canSync, elemMap]: [any, boolean, any[]]) => {
                    if (target === document) {
                        return ScrollEvent.outgoing(
                            getScrollPosition(window, document),
                            "document",
                            0
                        );
                    }

                    const elems = document.getElementsByTagName(target.tagName);
                    const index = Array.prototype.indexOf.call(
                        elems || [],
                        target
                    );

                    return ScrollEvent.outgoing(
                        getScrollPositionForElement(target),
                        target.tagName,
                        index,
                        elemMap.indexOf(target)
                    );
                })
            );
        })
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:30,代码来源:scroll.listener.ts


示例3: function

    return function(data, options: ReloadOptions): Observable<any> {
        const {path} = data;

        if (options.liveCSS) {
            if (path.match(/\.css$/i)) {
                return reloadStylesheet(path, document, navigator);
            }
        }

        if (options.liveImg) {
            if (path.match(/\.(jpe?g|png|gif)$/i)) {
                return reloadImages(path, document);
            }
        }

        /**
         * LEGACY
         */
        const domData = getElems(data.ext, options, document);
        const elems   = getMatches(domData.elems, data.basename, domData.attr);

        for (var i = 0, n = elems.length; i < n; i += 1) {
            swapFile(elems[i], domData, options, document, navigator);
        }

        return empty();
    }
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:27,代码来源:Reloader.ts


示例4: sendEmailVerification

 public sendEmailVerification() {
   if (this.auth$.auth.currentUser) {
     return Observable.fromPromise(
       this.auth$.auth.currentUser.sendEmailVerification(),
     );
   } else {
     return empty();
   }
 }
开发者ID:tja4472,项目名称:ngrx-ionic-angularfire,代码行数:9,代码来源:auth.service.ts


示例5: updatePassword

 public updatePassword(password: string) {
   if (this.auth$.auth.currentUser) {
     return Observable.fromPromise(
       this.auth$.auth.currentUser.updatePassword(password),
     );
   } else {
     return empty();
   }
 }
开发者ID:tja4472,项目名称:ngrx-ionic-angularfire,代码行数:9,代码来源:auth.service.ts


示例6: mergeMap

 mergeMap(([event, options]) => {
     if (event.url || !options.injectChanges) {
         return reloadBrowserSafe();
     }
     if (event.basename && event.ext && isBlacklisted(event)) {
         return empty();
     }
     return of(fileReload(event));
 })
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:9,代码来源:FileReload.ts


示例7: reloadStylesheet

    function reloadStylesheet(path: string, document: Document, navigator): Observable<any> {
        // has to be a real array, because DOMNodeList will be modified
        const links: HTMLLinkElement[] = array(document.getElementsByTagName('link'))
            .filter(link => {
                return link.rel.match(/^stylesheet$/i)
                    && !link.__LiveReload_pendingRemoval;
            });

        /**
         * Find imported style sheets in <style> tags
         * @type {any[]}
         */
        const styleImported = array(document.getElementsByTagName('style'))
            .filter(style => Boolean(style.sheet))
            .reduce((acc, style) => {
                return acc.concat(collectImportedStylesheets(style, style.sheet));
            }, []);

        /**
         * Find imported style sheets in <link> tags
         * @type {any[]}
         */
        const linksImported = links
            .reduce((acc, link) => {
                return acc.concat(collectImportedStylesheets(link, link.sheet));
            }, []);

        /**
         * Combine all links + sheets
         */
        const allRules = links.concat(styleImported, linksImported);

        /**
         * Which href best matches the incoming href?
         */
        const match = pickBestMatch(path, allRules, l => pathFromUrl(linkHref(l)));

        if (match) {
            if (match.object && match.object.rule) {
                return reattachImportedRule(match.object, document);
            }
            return reattachStylesheetLink(match.object, document, navigator);
        } else {
            if (links.length) {
                // no <link> elements matched, so was the path including '*'?
                const [first, ...rest] = path.split('.');
                if (first === '*') {
                    return from(links.map(link => reattachStylesheetLink(link, document, navigator)))
                        .pipe(mergeAll())
                }
            }
        }

        return empty();
    }
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:55,代码来源:Reloader.ts


示例8: map

 return folders.map(path => MyAppsPanelService.makeTreeNode({
     id: path,
     data: path,
     type: "folder",
     label: AppHelper.getBasename(path),
     isExpanded: this.localExpandedNodes.pipe(
         map(list => list.indexOf(path) !== -1)
     ),
     children: empty().pipe(
         concat(this.fileRepository.watch(path)),
         map(listing => this.createDirectoryListingTreeNodes(listing))
     )
 }));
开发者ID:hmenager,项目名称:composer,代码行数:13,代码来源:my-apps-panel.service.ts


示例9: calc

 calc(): Observable<any> {
   const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${this._formatAddress()}&key=${
     this._apiKey
   }`;
   if (!this._address.street && !this._address.zip && !this._address.city) {
     return empty();
   }
   return this._http.getRaw(url).pipe(
     map((res: ServiceResults) => {
       this._geoCodes = res.results[0].geometry.location;
       return this._geoCodes || undefined;
     })
   );
 }
开发者ID:digitaldeacon,项目名称:memberhive,代码行数:14,代码来源:geocode.service.ts


示例10: fetchFileContent

    fetchFileContent(almostID: string, parse = false): Observable<string> {

        const source = DataGatewayService.getFileSource(almostID);

        if (source === "local") {

            const fetch = empty().pipe(concat(this.ipc.request("getLocalFileContent", almostID)));

            if (parse) {
                return fetch.pipe(
                    map(content => {
                        try {
                            return YAML.safeLoad(content, {json: true, onWarning: noop} as any);
                        } catch (err) {
                            return new Error(err);
                        }
                    })
                );
            }

            return fetch;
        }

        if (source === "app" || source === "public") {

            const fetch = empty().pipe(
                concat(this.ipc.request("getPlatformApp", {id: almostID}))
            );

            if (parse) {
                return fetch.pipe(
                    map(content => JSON.parse(content))
                );
            }
            return fetch;
        }
    }
开发者ID:hmenager,项目名称:composer,代码行数:37,代码来源:data-gateway.service.ts



注:本文中的rxjs/observable/empty.empty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript EmptyObservable.EmptyObservable类代码示例发布时间:2022-05-25
下一篇:
TypeScript WebSocketSubject.WebSocketSubject类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap