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


TypeScript EventEmitter.subscribe方法代码示例

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


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

示例1:

				.then((fixture: ComponentFixture) => {
					fixture.detectChanges();
					ee.subscribe(null, null, () => {
						let logo: Element = fixture.nativeElement.querySelector('glyph');
						expect(logo.querySelector('svg')).not.toBe(null);
					});
				});
开发者ID:truongndnnguyen,项目名称:ng2-lab,代码行数:7,代码来源:glyph.spec.ts

示例2: constructor

    constructor(public location: Location, public route: Router) {
        this.locationChanged = false;
        this.actionEmitter = ActionNavigation.getEmitter();

        this.actionEmitter.subscribe(event => {
            //this.location.go('/'+event);

            //console.log('emitting', ActionNavigation.getEventEmitter(event));
            ActionNavigation.getEventEmitter(event).emit('start');
             
            //this.route.recognize(event);
        });
    }
开发者ID:jfbguy,项目名称:PersonaUI,代码行数:13,代码来源:app.component.ts

示例3: constructor

  constructor() {
    this.loginEvent = new EventEmitter();

    // If I implement revocation of JWTs from the server side, make sure to
    // cache JWTs that are revoked until they expire.
    this.loginEvent.subscribe((jwtResult: IJWT) => {
      this.jwtResult = jwtResult;
    });
    this.loggedIn = this.loginEvent
      .map((jwtResult: IJWT) => {
      return Boolean(jwtResult && jwtResult.aud);
    });
    // Necessary because you can't negate an Observable<boolean> or assign
    // within a map function inside a template
    this.loggedOut = this.loggedIn.map(b => !b);
  }
开发者ID:Ethan826,项目名称:diet-tracker,代码行数:16,代码来源:login.service.ts

示例4: constructor

    constructor() {

        this.webSocket = new WebSocket("ws://localhost:3001");

        this.isReady = false;

        this.pending = new Array<string>();

        this.emitter = new EventEmitter<string>();

        this.resolveMap = new Map<Object, Object>();

        this.webSocket.onerror = ((event) => {
            console.log(event);
        });

        this.webSocket.onmessage = ((event) => {
            this.emitter.next(event);
        });

        this.webSocket.onclose = ((event) => {
            console.log(event);
        });

        this.webSocket.onopen = ((event) => {
            console.log(event);
            this.isReady = true;
            this.pending.forEach(request => {
                this.webSocket.send(request);
            });
        });

        this.emitter.subscribe((event) => {
            let data = JSON.parse(event.data);
            let resolve = this.resolveMap.get(data.file);
            console.log(data.content);
            console.log(resolve);
        });

    }
开发者ID:bram-atmire,项目名称:angular2-ui-prototype,代码行数:40,代码来源:websocket.service.ts

示例5: reloadEvent

 @Input() set reloadEvent(v: EventEmitter<void>) {
     v.subscribe(() => this.refresh());
 }
开发者ID:bacchus-diary,项目名称:Client,代码行数:3,代码来源:suggestions.ts

示例6: Promise

 return new Promise((resolve, reject) => {
   this.loginEvent.subscribe(
     (jwtResult: IJWT) => { resolve(jwtResult); },
     (err: any) => { reject(err); }
     );
 });
开发者ID:Ethan826,项目名称:diet-tracker,代码行数:6,代码来源:login.service.ts


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