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


TypeScript core.Emitter類代碼示例

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


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

示例1: it

    it('when subscribing twice', () => {
      var events = new Emitter();
      var sub1Called = 0;

      function handler() {
        sub1Called += 1;
      }

      events.on('test', handler);
      events.on('test', handler);

      events.emit('test', null);

      expect(sub1Called).to.be(2);
    });
開發者ID:PaulMest,項目名稱:grafana,代碼行數:15,代碼來源:emitter_specs.ts

示例2: initEditMode

 initEditMode() {
   if (!this.editModeInitiated) {
     this.editModeInitiated = true;
     this.events.emit('init-edit-mode', null);
     this.maxPanelsPerRowOptions = getFactors(GRID_COLUMN_COUNT);
   }
 }
開發者ID:CorpGlory,項目名稱:grafana,代碼行數:7,代碼來源:panel_ctrl.ts

示例3: getExtendedMenu

  getExtendedMenu() {
    const menu = [];
    if (!this.panel.fullscreen && this.dashboard.meta.canEdit) {
      menu.push({
        text: 'Duplicate',
        click: 'ctrl.duplicate()',
        role: 'Editor',
        shortcut: 'p d',
      });

      menu.push({
        text: 'Copy',
        click: 'ctrl.copyPanel()',
        role: 'Editor',
      });
    }

    menu.push({
      text: 'Panel JSON',
      click: 'ctrl.editPanelJson(); dismiss();',
    });

    this.events.emit('init-panel-actions', menu);
    return menu;
  }
開發者ID:CorpGlory,項目名稱:grafana,代碼行數:25,代碼來源:panel_ctrl.ts

示例4: render

  render(payload?) {
    // ignore if other panel is in fullscreen mode
    if (this.otherPanelInFullscreenMode()) {
      return;
    }

    this.events.emit('render', payload);
  }
開發者ID:ArtyomyuS,項目名稱:grafana,代碼行數:8,代碼來源:panel_ctrl.ts

示例5: init

  init() {
    this.calculatePanelHeight();

    this.publishAppEvent('panel-initialized', {scope: this.$scope});
    this.events.emit('panel-initialized');

    this.refresh();
  }
開發者ID:1tylermitchell,項目名稱:grafana,代碼行數:8,代碼來源:panel_ctrl.ts

示例6: render

  render(payload?) {
    // ignore if other panel is in fullscreen mode
    if (this.otherPanelInFullscreenMode()) {
      return;
    }

    this.calculatePanelHeight();
    this.timing.renderStart = new Date().getTime();
    this.events.emit('render', payload);
  }
開發者ID:mtanda,項目名稱:grafana,代碼行數:10,代碼來源:panel_ctrl.ts

示例7: refresh

  refresh() {
    if (!this.isPanelVisible() && !this.dashboard.meta.soloMode && !this.dashboard.snapshot) {
      this.skippedLastRefresh = true;
      return;
    }

    this.skippedLastRefresh = false;

    this.events.emit('refresh', null);
  }
開發者ID:martinwalsh,項目名稱:grafana,代碼行數:10,代碼來源:panel_ctrl.ts

示例8: initEditMode

  initEditMode() {
    this.editorTabs = [];
    this.addEditorTab('General', 'public/app/partials/panelgeneral.html');
    this.editModeInitiated = true;
    this.events.emit('init-edit-mode', null);

    var urlTab = (this.$injector.get('$routeParams').tab || '').toLowerCase();
    if (urlTab) {
      this.editorTabs.forEach((tab, i) => {
        if (tab.title.toLowerCase() === urlTab) {
          this.editorTabIndex = i;
        }
      });
    }
  }
開發者ID:mtanda,項目名稱:grafana,代碼行數:15,代碼來源:panel_ctrl.ts


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