本文整理汇总了TypeScript中app/core/core.Emitter.emit方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Emitter.emit方法的具体用法?TypeScript Emitter.emit怎么用?TypeScript Emitter.emit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/core/core.Emitter
的用法示例。
在下文中一共展示了Emitter.emit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: initEditMode
initEditMode() {
if (!this.editModeInitiated) {
this.editModeInitiated = true;
this.events.emit('init-edit-mode', null);
this.maxPanelsPerRowOptions = getFactors(GRID_COLUMN_COUNT);
}
}
示例2: 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;
}
示例3: render
render(payload?) {
// ignore if other panel is in fullscreen mode
if (this.otherPanelInFullscreenMode()) {
return;
}
this.events.emit('render', payload);
}
示例4: init
init() {
this.calculatePanelHeight();
this.publishAppEvent('panel-initialized', {scope: this.$scope});
this.events.emit('panel-initialized');
this.refresh();
}
示例5: 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);
}
示例6: refresh
refresh() {
if (!this.isPanelVisible() && !this.dashboard.meta.soloMode && !this.dashboard.snapshot) {
this.skippedLastRefresh = true;
return;
}
this.skippedLastRefresh = false;
this.events.emit('refresh', null);
}
示例7: it
it('should handle errors', () => {
var events = new Emitter();
var sub1Called = 0;
var sub2Called = 0;
events.on('test', () => {
sub1Called++;
throw {message: "hello"};
});
events.on('test', () => {
sub2Called++;
});
try { events.emit('test', null); } catch (_) { }
try { events.emit('test', null); } catch (_) {}
expect(sub1Called).to.be(2);
expect(sub2Called).to.be(0);
});
示例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;
}
});
}
}