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


TypeScript operators.skip函數代碼示例

本文整理匯總了TypeScript中rxjs/operators.skip函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript skip函數的具體用法?TypeScript skip怎麽用?TypeScript skip使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了skip函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

  it('should emit rangeChange when selected start and end dates', (done) => {
    rangepicker.visibleDate = new Date(2018, 8, 17);
    showRangepicker();

    rangepicker.rangeChange
      .pipe(skip(1))
      .subscribe((range: NbCalendarRange<Date>) => {
        expect(range.start.getFullYear()).toEqual(2018);
        expect(range.end.getFullYear()).toEqual(2018);
        expect(range.start.getMonth()).toEqual(8);
        expect(range.end.getMonth()).toEqual(8);
        expect(range.start.getDate()).toEqual(1);
        expect(range.end.getDate()).toEqual(3);
        done();
      });

    // click on Sep 1
    const startCell = overlay.querySelectorAll('.day-cell')[6];
    (startCell as HTMLElement).click();
    // click on Sep 3
    const endCell = overlay.querySelectorAll('.day-cell')[8];
    (endCell as HTMLElement).click();

    fixture.detectChanges();
  }, 5000);
開發者ID:kevinheader,項目名稱:nebular,代碼行數:25,代碼來源:datepicker.spec.ts

示例2: it

    it('should be able to filter snapshotChanges() types - added/modified', async (done) => {
      const ITEMS = 10;
      let { randomCollectionName, ref, stocks, names } = await collectionHarness(afs, ITEMS);
      const nextId = ref.doc('a').id;
      let count = 0;

      const sub = stocks.snapshotChanges(['added', 'modified']).pipe(skip(1),take(2)).subscribe(data => {
        count += 1;
        if (count == 1) {
          const change = data.filter(x => x.payload.doc.id === nextId)[0];
          expect(data.length).toEqual(ITEMS + 1);
          expect(change.payload.doc.data().price).toEqual(2);
          expect(change.type).toEqual('added');
          delayUpdate(stocks, names[0], { price: 2 });
        }
        if (count == 2) {
          const change = data.filter(x => x.payload.doc.id === names[0])[0];
          expect(data.length).toEqual(ITEMS + 1);
          expect(change.payload.doc.data().price).toEqual(2);
          expect(change.type).toEqual('modified');
        }
      }).add(() => {
        deleteThemAll(names, ref).then(done).catch(done.fail);
      });

      names = names.concat([nextId]);
      delayAdd(stocks, nextId, { price: 2 });
    });
開發者ID:Tetsumote,項目名稱:angularfire2,代碼行數:28,代碼來源:collection.spec.ts

示例3: it

  it('should allow going forward a route with type `goForward`', done => {
    function main(_sources: {history: Observable<Location>}) {
      return {
        history: of<HistoryInput | string>(
          '/test',
          '/other',
          {type: 'go', amount: -1},
          {type: 'goForward'}
        ),
      };
    }

    const {sources, run} = setup(main, {
      history: makeServerHistoryDriver(),
    });

    const expected = ['/test', '/other', '/test', '/other'];

    sources.history.pipe(skip(1)).subscribe({
      next(location: Location) {
        assert.strictEqual(location.pathname, expected.shift());
        if (expected.length === 0) {
          done();
        }
      },
      error: done,
      complete: () => {
        done('complete should not be called');
      },
    });
    run();
  });
開發者ID:,項目名稱:,代碼行數:32,代碼來源:

示例4: it

    it('should get Gamma sidekick after creating and assigning one', (done: DoneFn) => {
      // Skip(1), the initial state in which Gamma has no sidekick
      // Note that BOTH dispatches complete synchronously, before the selector updates
      // so we only have to skip one.
      createHeroSidekickSelector$(3)
        .pipe(skip(1))
        .subscribe(sk => {
          expect(sk.name).toBe('Robin');
          done();
        });

      // create a new sidekick
      let action: EntityAction = eaFactory.create<Sidekick>('Sidekick', EntityOp.ADD_ONE, {
        id: 42,
        name: 'Robin'
      });
      store.dispatch(action);

      // assign new sidekick to Gamma
      action = eaFactory.create<Update<Hero>>('Hero', EntityOp.UPDATE_ONE, {
        id: 3,
        changes: { id: 3, sidekickFk: 42 }
      });
      store.dispatch(action);
    });
開發者ID:RajeevSingh273,項目名稱:angular-ngrx-data,代碼行數:25,代碼來源:related-entity-selectors.spec.ts

示例5: resolve

	resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Page<Item>> {
		this.store.dispatch(
			new FindItemsByPodcastsAndPageAction(route.params.id)
		);

		return this.store.pipe(select(selectPodcastItems), skip(1), take(1));
	}
開發者ID:davinkevin,項目名稱:Podcast-Server,代碼行數:7,代碼來源:podcast-items.resolver.ts

示例6: it

  it('should unsubscribe scheduled actions after execution', () => {
    let subscribeSpy: any = null;
    const counts: number[] = [];

    const e1 =       cold('a|');
    const expected =      '--a-(a|)';
    const duration = time('-|');
    const result = e1.pipe(
      repeatWhen(notifications => {
        const delayed = notifications.pipe(delay(duration, rxTestScheduler));
        subscribeSpy = sinon.spy(delayed['source'], 'subscribe');
        return delayed;
      }),
      skip(1),
      take(2),
      tap({
        next() {
          const [[subscriber]] = subscribeSpy.args;
          counts.push(subscriber._subscriptions.length);
        },
        complete() {
          expect(counts).to.deep.equal([1, 1]);
        }
      })
    );

    expectObservable(result).toBe(expected);
  });
開發者ID:tomastrajan,項目名稱:rxjs,代碼行數:28,代碼來源:delay-spec.ts

示例7: it

 it('should emit true when the socket establishes a connection with the ws server', done => {
     const brayns = new Client(host);
     brayns.ready.pipe(skip(1), take(1))
         .subscribe(ready => {
             expect(ready).toBe(true);
             done();
         });
 });
開發者ID:chevtche,項目名稱:Brayns,代碼行數:8,代碼來源:client.spec.ts

示例8: it

  it('should complete regardless of skip count if source is empty', () => {
    const e1 =  cold('|');
    const e1subs =   '(^!)';
    const expected = '|';

    expectObservable(e1.pipe(skip(3))).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
  });
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:8,代碼來源:skip-spec.ts

示例9: asDiagram

  asDiagram('skip(3)')('should skip values before a total', () => {
    const source = hot('--a--b--c--d--e--|');
    const subs =       '^                !';
    const expected =   '-----------d--e--|';

    expectObservable(source.pipe(skip(3))).toBe(expected);
    expectSubscriptions(source.subscriptions).toBe(subs);
  });
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:8,代碼來源:skip-spec.ts


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