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


TypeScript Subject.next方法代码示例

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


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

示例1: switch

                message: (message) => {
                    console.debug('Received from server the following : ', message['data']['data']);

                    const communication: ServerCommunication = message['data']['data'];

                    switch(communication['type']){

                        case 'question':
                            this._questions.next(communication);
                            break;

                        case 'notification':
                            console.log('received a notif');
                            this._notifs.next(communication);
                            break;

                        case 'scores':
                            this._scores.next(communication['content']);
                            break;

                        case 'complete':
                            this._questions.complete();
                            break;

                        default:
                            console.log('Type of the communication unknown');
                            break;
                    }
                },
开发者ID:aGautrain,项目名称:ZetaPush-quizz,代码行数:29,代码来源:quizz.service.ts

示例2: inject

      inject([Overlay], (overlay: Overlay) => {
        overlayRef.dispose();
        scrollPosition = 100;

        overlayRef = overlay.create({
          scrollStrategy: overlay.scrollStrategies.close({threshold: 50})
        });

        overlayRef.attach(componentPortal);
        spyOn(overlayRef, 'updatePosition');
        spyOn(overlayRef, 'detach');

        // Scroll down 30px.
        for (let i = 0; i < 30; i++) {
          scrollPosition++;
          scrolledSubject.next();
        }

        // Scroll back up 30px.
        for (let i = 0; i < 30; i++) {
          scrollPosition--;
          scrolledSubject.next();
        }

        expect(overlayRef.updatePosition).toHaveBeenCalledTimes(60);
        expect(overlayRef.detach).not.toHaveBeenCalled();
      }));
开发者ID:ravichandra480,项目名称:material2,代码行数:27,代码来源:close-scroll-strategy.spec.ts

示例3: xit

 xit('Should display notification about cached content only once', () => {
     localStorage.clear();
     activated.next({current: {hash: 'asdf'}} as UpdateActivatedEvent);
     activated.next({current: {hash: 'asdf'}} as UpdateActivatedEvent);
     expect(snackBarServiceStub.displayNotification.called).toBe(true, 'Notification was not displayed');
     expect(snackBarServiceStub.displayNotification.calledOnce).toBe(true, 'Notification was not displayed once');
 });
开发者ID:yantrixs,项目名称:angular-universal-pwa,代码行数:7,代码来源:app.component.spec.ts

示例4: it

      it ('Check collapsed', () => {
        userSettingState = UserSettingUtil.updateUserSettingState(userSettingState, mutable => {
          mutable.swimlane = 'component';
          mutable.defaultCollapsedSwimlane = false;
          mutable.collapsedSwimlanes = Map<string, boolean>({'a': true, 'b': true, 'c': true, 'd': false});
        });
        userSettingSubject.next(userSettingState);
        urlObservable
          .pipe(
            take(1)
          )
          .subscribe(s => {
            expect(s).toContain('hidden-sl=a,b,c');
            expect(s).not.toContain('visible-sl');
        });

        userSettingState = UserSettingUtil.updateUserSettingState(userSettingState, mutable => {
          mutable.swimlane = 'component';
          mutable.defaultCollapsedSwimlane = true;
          mutable.collapsedSwimlanes = Map<string, boolean>({'a': false, 'b': false, 'c': false, 'd': true});
        });
        userSettingSubject.next(userSettingState);
        urlObservable
          .pipe(
            take(1)
          )
          .subscribe(s => {
            expect(s).toContain('visible-sl=a,b,c');
            expect(s).not.toContain('hidden-sl');
        });

      })
开发者ID:rsvoboda,项目名称:overbaard-redux,代码行数:32,代码来源:board-query-params.service.spec.ts

示例5: test

 test("Gives the latest options when options are changed", () => {
     let changingConfig = "omnisharp";
     updateConfig(vscode, changingConfig, 'path', "somePath");
     optionObservable.next(Options.Read(vscode));
     updateConfig(vscode, changingConfig, 'path', "anotherPath");
     optionObservable.next(Options.Read(vscode));
     let options = optionProvider.GetLatestOptions();
     expect(options.path).to.be.equal("anotherPath");
 });
开发者ID:gregg-miskelly,项目名称:omnisharp-vscode,代码行数:9,代码来源:OptionProvider.test.ts

示例6: it

  it('should update the overlay position when the page is scrolled', () => {
    overlayRef.attach(componentPortal);
    spyOn(overlayRef, 'updatePosition');

    scrolledSubject.next();
    expect(overlayRef.updatePosition).toHaveBeenCalledTimes(1);

    scrolledSubject.next();
    expect(overlayRef.updatePosition).toHaveBeenCalledTimes(2);
  });
开发者ID:Chintuz,项目名称:material2,代码行数:10,代码来源:reposition-scroll-strategy.spec.ts

示例7: it

    it('should create a new todo', () => {
        const actions = new Subject<Action>();
        const states = stateFn({ todos: [], visibilityFilter: 'SHOW_ALL' }, actions);

        actions.next(new AddTodoAction(100, 'todo1'));
        actions.next(new AddTodoAction(101, 'todo2'));

        states.subscribe(s => {
            expect(s.todos.length).toEqual(2);
            expect(s.todos[0]).toEqual({ id: 100, text: 'todo1', completed: false });
            expect(s.todos[1]).toEqual({ id: 101, text: 'todo2', completed: false });
        });
    });
开发者ID:gotstago,项目名称:rxjs-learning,代码行数:13,代码来源:actions.spec.ts

示例8: it

    it('should work', () => {
      const subject = new Subject<number>();

      const log: number[] = [];
      subject.map(x => 2 * x + 1)
        .subscribe(next => log.push(next));

      subject.next(2);
      expect(log).toEqual([5]);

      subject.next(3);
      expect(log).toEqual([5, 7]);
    });
开发者ID:loki2302,项目名称:html5-experiment,代码行数:13,代码来源:rxjs.spec.ts


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