当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Subscriber.complete方法代码示例

本文整理汇总了TypeScript中rxjs/Rx.Subscriber.complete方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Subscriber.complete方法的具体用法?TypeScript Subscriber.complete怎么用?TypeScript Subscriber.complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs/Rx.Subscriber的用法示例。


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

示例1: registerDbListeners

    /**
     * registerDbListeners()
     * 
     * ref: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB#Version_changes_while_a_web_app_is_open_in_another_tab
     * ref: https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore
     */
    private registerDbListeners(observer: Subscriber<any>, database: IDBDatabase){
        
        // onerror and onabort are listed as part of the definitions...
        database.onerror = (ev:Event) => {
            this.logEvent("db", ev)
        };
        
        database.onabort = (ev:Event) => {
            this.logEvent("db", ev)
        };
        
        // onversionchange and onclose are listed object properties in Chrome
        database.onversionchange = (ev:Event) => {
            this.logEvent("db", ev)
            database.close();
            observer.error("IndexedDB schema version changed. Reload window is suggested")
        };
        
        database.onclose = (ev:Event) => {
            this.logEvent("db", ev)
        };

        observer.next(database)
        observer.complete()
    }
开发者ID:aheinrich,项目名称:ng2-web-storage,代码行数:31,代码来源:indexeddb.service.ts

示例2: insertRecord

            const insertRecord = () => {
                if ( i < recordList.length) {
                    
                    let request:IDBRequest;
                    
                    if (keyList) {
                        request = store.add(recordList[i], keyList[i])
                    } else {
                        request = store.add(recordList[i])
                    }
                    
                    request.onsuccess = (ev:Event) => {
                        this.logEvent("insertBatch", ev)
                        observer.next(i)
                        insertRecord()
                    };

                    request.onerror = (ev:Event) => {
                        this.logEvent("insertBatch", ev)
                        observer.error(ev.target.error)
                    };                    
                    ++i
                } else {
                    observer.complete()
                }
            }
开发者ID:aheinrich,项目名称:ng2-web-storage,代码行数:26,代码来源:indexeddb.service.ts

示例3:

			self.ref.set(data, (err) => {
				if(err != null){
					subscriber.error(err);
				}else{
					subscriber.next({});
					subscriber.complete();
				}
			})
开发者ID:BethelTV,项目名称:rxjsfirebase,代码行数:8,代码来源:index.ts

示例4: RxFirebase

            var newRef = self.ref.push(data, (err) => {
                if(err != null){
					subscriber.error(err);
				}else{
					subscriber.next(new RxFirebase(newRef));
					subscriber.complete();
				}
            })
开发者ID:BethelTV,项目名称:rxjsfirebase,代码行数:8,代码来源:index.ts

示例5: setInterval

		var handle = setInterval(() => { // tslint:disable-line:no-var-keyword
			if (data.length) {
				subscriber.next(data.shift());
			} else {
				subscriber.complete();
				clearInterval(handle);
			}
		}, 1000);
开发者ID:novemberborn,项目名称:dojo2-dataviz,代码行数:8,代码来源:play-counts.ts

示例6:

 var handleSuccess = (ev: Event) => {
     this.logEvent('dropDatabase', ev)
     if (ev.oldVersion > 0){
         observer.next()
         observer.complete()    
     } else {
         observer.error(`Cannot find requested database '${databaseName}'`)
     }
 }
开发者ID:aheinrich,项目名称:ng2-web-storage,代码行数:9,代码来源:indexeddb.service.ts

示例7:

 }).subscribe((data: {version: string}) => {
   obs.next(data.version);
   obs.complete();
 });
开发者ID:dillondrenzek,项目名称:Palette-web,代码行数:4,代码来源:meta.service.ts

示例8:

 this.ws.onopen = event => {
   openSubscriber.next();
   openSubscriber.complete();
 };
开发者ID:AviFix,项目名称:angular2typescript,代码行数:4,代码来源:websocket-service.ts


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