• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript aurelia-event-aggregator.EventAggregator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中aurelia-event-aggregator.EventAggregator的典型用法代码示例。如果您正苦于以下问题:TypeScript EventAggregator类的具体用法?TypeScript EventAggregator怎么用?TypeScript EventAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: constructor

 constructor(private _ea: EventAggregator){
   this._ea.subscribe(Events.bootstrapChosen, () => {
     this.router.navigate('bootstrap');
   });
   this._ea.subscribe(Events.polymerChosen, () => {
     this.router.navigate('polymer');
   });
 }
开发者ID:avizcaino,项目名称:book-shelf,代码行数:8,代码来源:app.ts


示例2: constructor

 constructor(private api: AdnAPI, private ea: EventAggregator) {
     this.posts = new PostsModel(ea);
     this.streamOptions = new StreamOptions(false, '', 0, false);
     this.postPosted = ea.subscribe(PostPosted, () => this.loadStream(this.streamOptions, false));
     this.refreshView = ea.subscribe(RefreshView, () => this.loadStream(this.streamOptions, false));
     this.loadMore = ea.subscribe(LoadMore, () => this.loadStream(this.streamOptions, true));
     this.streamOptions.loadToStreamMarker = true;
     this.loadUntilStreamMarker = ea.subscribe(LoadUntilStreamMarker, () => this.loadStream(this.streamOptions, true));
 }
开发者ID:mttmccb,项目名称:dark_social,代码行数:9,代码来源:posts-stream.ts


示例3: constructor

 constructor(af: ApiFactory, private events: EventAggregator) {
   this.api = af.create(Product);
   this.api.all()
     .then(prods => this.products = prods);
   
   this.unsubs = [
     this.events.subscribe('product.saved', prod => this.add(prod)),
     this.events.subscribe('product.removed', prod => this.remove(prod))
   ];
 }
开发者ID:jussik,项目名称:ssgl,代码行数:10,代码来源:productList.ts


示例4: constructor

    constructor(ea: EventAggregator, logger: Log, element: Element, animator: VelocityAnimator) {
        this.ea = ea;
        this.logger = logger;
        this.element = element;
        this.animator = animator;

        this.ea.subscribe(MinimizeWidge.EventTypes.MINIMIZE, context => { this.onMinimize(context) });
        this.ea.subscribe(MinimizeWidge.EventTypes.RESTORE, context => { this.onRestore(context) });

        this.isContentHidden = false;
    }
开发者ID:macinnir,项目名称:au-demos,代码行数:11,代码来源:widget.panel.ts


示例5: constructor

  constructor(eventAggregator: EventAggregator, api: WebAPI) {
    this.ea = eventAggregator;
    this.api = api;

    this.ea.subscribe(ContactViewed, msg => {
      this.select(msg.contact)
    });
    this.ea.subscribe(ContactUpdated, msg => {
      let id = msg.contact.id;
      let found = this.contacts.find(x => x.id == id);
      Object.assign(found, msg.contact);
    });
  }
开发者ID:ghiscoding,项目名称:Realtime-TODO-Aurelia-RethinkDB,代码行数:13,代码来源:contact-list.ts


示例6: prepare

    prepare() {
        if (this.router.isConfigured) {
            return;
        }

        this.router.configure((config: RouterConfiguration) => {
            config.title = 'Aurelia';
            config.map([
                { route: ['', 'login'], name: 'login', moduleId: 'login' },
                { route: 'page1', name: 'page1', moduleId: 'page1', settings: { auth: true } },
                { route: 'page2', name: 'page2', moduleId: 'page2', settings: { auth: true } }
            ]);
            config.addAuthorizeStep(AuthPlugin);

            return config;
        });

        let callback = (eventArgs: Object, name) => {
            logger.warn(eventArgs['instruction']['config']['name'], name);
        };

        this.eventAggregator.subscribe('router:navigation:processing', callback);
        this.eventAggregator.subscribe('router:navigation:error', callback);
        this.eventAggregator.subscribe('router:navigation:canceled', callback);
        this.eventAggregator.subscribe('router:navigation:success', callback);
        this.eventAggregator.subscribe('router:navigation:complete', callback);
    }
开发者ID:codeaid,项目名称:skeleton-navigation,代码行数:27,代码来源:router-config.ts


示例7: frameworkSelected

 frameworkSelected(framework:string) {
     switch (framework) {
         case FrameworkType.Polymer:
             this._ea.publish(Events.polymerChosen);
             break;
         case FrameworkType.Bootstrap:
             this._ea.publish(Events.bootstrapChosen);
             break;
     }
 }
开发者ID:avizcaino,项目名称:book-shelf,代码行数:10,代码来源:framework-selector.ts


示例8: ApiStatus

      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Post Reported', { status: 'success' }));
        return response.content.data;

      }).catch((err: any) => {
开发者ID:mttmccb,项目名称:dark_social,代码行数:7,代码来源:adn-api.ts


示例9: RefreshedView

 }).then(() => {
     if (so.loadToStreamMarker && this.api.meta.min_id > this.api.meta.marker.last_read_id) {
         this.loadStream(this.streamOptions, true);
     } else {
         this.ea.publish(new RefreshedView());
     }
 });
开发者ID:mttmccb,项目名称:dark_social,代码行数:7,代码来源:posts-stream.ts


示例10: Error

    return Promise.resolve().then(() => {
      if (this.isNavigating && !instructionCount) {
        // ts complains about inconsistent returns without void 0
        return void 0;
      }

      let instruction = this._queue.shift();
      this._queue.length = 0;

      if (!instruction) {
        // ts complains about inconsistent returns without void 0
        return void 0;
      }

      this.isNavigating = true;

      let navtracker: number = this.history.getState('NavigationTracker');
      let currentNavTracker = this.currentNavigationTracker;

      if (!navtracker && !currentNavTracker) {
        this.isNavigatingFirst = true;
        this.isNavigatingNew = true;
      } else if (!navtracker) {
        this.isNavigatingNew = true;
      } else if (!currentNavTracker) {
        this.isNavigatingRefresh = true;
      } else if (currentNavTracker < navtracker) {
        this.isNavigatingForward = true;
      } else if (currentNavTracker > navtracker) {
        this.isNavigatingBack = true;
      } if (!navtracker) {
        navtracker = Date.now();
        this.history.setState('NavigationTracker', navtracker);
      }
      this.currentNavigationTracker = navtracker;

      instruction.previousInstruction = this.currentInstruction;

      let maxInstructionCount = this.maxInstructionCount;

      if (!instructionCount) {
        this.events.publish(RouterEvent.Processing, { instruction });
      } else if (instructionCount === maxInstructionCount - 1) {
        logger.error(`${instructionCount + 1} navigation instructions have been attempted without success. Restoring last known good location.`);
        restorePreviousLocation(this);
        return this._dequeueInstruction(instructionCount + 1);
      } else if (instructionCount > maxInstructionCount) {
        throw new Error('Maximum navigation attempts exceeded. Giving up.');
      }

      let pipeline = this.pipelineProvider.createPipeline(!this.couldDeactivate);

      return pipeline
        .run(instruction)
        .then(result => processResult(instruction, result, instructionCount, this))
        .catch(error => {
          return { output: error instanceof Error ? error : new Error(error) } as PipelineResult;
        })
        .then(result => resolveInstruction(instruction, result, !!instructionCount, this));
    });
开发者ID:aurelia,项目名称:router,代码行数:60,代码来源:app-router.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript aurelia-fetch-client.json函数代码示例发布时间:2022-05-25
下一篇:
TypeScript aurelia-dialog.DialogService类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap