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


TypeScript Subscriber.next方法代碼示例

本文整理匯總了TypeScript中rxjs/Rx.Subscriber.next方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Subscriber.next方法的具體用法?TypeScript Subscriber.next怎麽用?TypeScript Subscriber.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rxjs/Rx.Subscriber的用法示例。


在下文中一共展示了Subscriber.next方法的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:

					const observable = new Observable<T[]>((subscriber: Subscriber<T[]>) => {
						managedSubscriber = subscriber;
						if (latestValue) {
							subscriber.next(latestValue);
							latestValue = null;
						}
					});
開發者ID:novemberborn,項目名稱:dojo2-dataviz,代碼行數:7,代碼來源:createInputSeriesMixin.ts

示例3: 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

示例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:

			self.ref.set(data, (err) => {
				if(err != null){
					subscriber.error(err);
				}else{
					subscriber.next({});
					subscriber.complete();
				}
			})
開發者ID:BethelTV,項目名稱:rxjsfirebase,代碼行數:8,代碼來源:index.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: setInterval

      const intervalo = setInterval( () => {

        contador++;


        const salida = {
          valor: contador
        };


        observer.next(salida);


        // if ( contador === 3 ) {
        //   clearInterval(intervalo);
        //   observer.complete();
        // }

        // if ( contador === 2 ) {
        //   // clearInterval(intervalo);
        //   observer.error('Auxilio!');
        // }

      }, 1000 );
開發者ID:mardanga,項目名稱:adminPro,代碼行數:24,代碼來源:rxjs.component.ts

示例8: setInterval

 setInterval(() => obs.next(++i), 1000);
開發者ID:0xJoKe,項目名稱:angular,代碼行數:1,代碼來源:observable_patched.ts


注:本文中的rxjs/Rx.Subscriber.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。