Skip to content

Commit

Permalink
refactor: rename emitter to emit
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor committed Oct 20, 2020
1 parent 7c665dc commit e40c364
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/eventEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class EventEmitter {
* it's going to emit event
* @param name Event name
*/
export function emitter(name: string) {
export function emit(name: string) {
return function(
target,
property: string,
Expand Down
6 changes: 3 additions & 3 deletions src/services/activityBarService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActivityBarEvent, IActivityBar, IActivityBarItem } from 'mo/core/activityBar';
import { emitter } from 'mo/common/eventEmitter';
import { emit } from 'mo/common/eventEmitter';

export class ActivityBarService implements IActivityBar {
data: IActivityBarItem[];
Expand All @@ -10,7 +10,7 @@ export class ActivityBarService implements IActivityBar {
this.selected = selected;
}

@emitter(ActivityBarEvent.Selected)
@emit(ActivityBarEvent.Selected)
public onSelect(key: string, item?: IActivityBarItem) {
this.selected = key;
}
Expand All @@ -19,7 +19,7 @@ export class ActivityBarService implements IActivityBar {

}

@emitter(ActivityBarEvent.DataChanged)
@emit(ActivityBarEvent.DataChanged)
public push(data: IActivityBarItem | IActivityBarItem[]) {
if (Array.isArray(data)) {
this.data = this.data.concat(data);
Expand Down
6 changes: 3 additions & 3 deletions src/services/editor/editorService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ITab } from 'mo/components/tabs';
import { EditorEvent, IEditor, IEditorGroup } from 'mo/core/editor';
import { emitter } from 'mo/common/eventEmitter';
import { emit } from 'mo/common/eventEmitter';

export class EditorService<T = any> implements IEditor<T> {
public current: IEditorGroup;
Expand All @@ -11,7 +11,7 @@ export class EditorService<T = any> implements IEditor<T> {
this.groups = groups;
}

@emitter(EditorEvent.OpenTab)
@emit(EditorEvent.OpenTab)
public open(tab: ITab<T>, groupId?: number) {
let group: IEditorGroup | undefined = this.current;
if (groupId) {
Expand All @@ -27,7 +27,7 @@ export class EditorService<T = any> implements IEditor<T> {

}

@emitter(EditorEvent.CloseTab)
@emit(EditorEvent.CloseTab)
public onClose() {

}
Expand Down

0 comments on commit e40c364

Please sign in to comment.