Skip to content

Commit 6ccd70c

Browse files
committed
feat: declare service interface
1 parent ed499e9 commit 6ccd70c

12 files changed

+22
-277
lines changed

src/extensions/activityBar/src/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { activityBar } from 'mo/index';
2-
import { ActivityBarEvent, IActivityBarItem } from 'mo/core/workbench/activityBar';
1+
import { activityBar, ActivityBarEvent, IActivityBarItem } from 'mo/index';
32
import { ExtensionService } from 'mo/services/extensionService';
43

54
function initActivityBar(extensionCtx: ExtensionService) {

src/extensions/explore/src/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
2-
import { ActivityBarEvent, IActivityBarItem } from 'mo/core/workbench/activityBar';
3-
import { activityBar, sidebar } from 'mo/index';
2+
import { activityBar, ActivityBarEvent, IActivityBarItem, sidebar } from 'mo/index';
43

54
import { Explorer } from './explore';
65
import { ExtensionService } from 'mo/services/extensionService';

src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export * from 'mo/services';
22
export * from 'mo/provider';
33
export * from 'mo/workbench';
44
export * from 'mo/common/event';
5-
export * from 'mo/core';

src/services/activityBarService.ts

-57
This file was deleted.

src/services/baseService.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
export abstract class BaseService {
1+
import { EventService } from './eventService';
2+
3+
export abstract class BaseService<S = any> {
4+
public abstract getState(): S;
25
/**
36
* Subscribe the service event
47
* @param name Event name
58
* @param callback Callback function
69
*/
7-
public abstract subscribe(name: string | string [], callback: Function);
10+
public subscribe(name: string | string [], callback: Function) {
11+
EventService.subscribe(name, callback);
12+
}
813
}

src/services/editor/editorService.ts

-55
This file was deleted.

src/services/editor/groupService.ts

-30
This file was deleted.

src/services/index.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import 'reflect-metadata';
22
export * from './eventService';
3-
export * from './activityBarService';
3+
export * from './workbench/activityBarService';
44
export * from './eventService';
55
export * from './extensionService';
6-
export * from './menuBarService';
7-
export * from './sidebarService';
6+
export * from './workbench/menuBarService';
7+
export * from './workbench/sidebarService';
88
export * from './themeService';
9-
export * from './moleculeService';
10-
export * from './editor/editorService';
9+
export * from './workbench/editorService';
1110
export * from './stateService';
11+
export * from './workbench/statusBarService';
1212

1313
import { container } from 'tsyringe';
14-
import { ActivityBarService } from './activityBarService';
14+
import { ActivityBarService } from './workbench/activityBarService';
1515
import { ExtensionService } from './extensionService';
16-
import { SidebarService } from './sidebarService';
17-
import { MenuBarService } from './menuBarService';
16+
import { SidebarService } from './workbench/sidebarService';
17+
import { MenuBarService } from './workbench/menuBarService';
1818
import { ThemeService } from './themeService';
19-
import { EditorService } from './editor/editorService';
19+
import { EditorService } from './workbench/editorService';
20+
import { StatusBarService } from './workbench/statusBarService';
2021

2122
/**
2223
* The Services of Workbench
@@ -25,6 +26,7 @@ const activityBar = container.resolve(ActivityBarService);
2526
const sidebar = container.resolve(SidebarService);
2627
const menuBar = container.resolve(MenuBarService);
2728
const editor = container.resolve(EditorService);
29+
const statusBar = container.resolve(StatusBarService);
2830

2931
/**
3032
* The theme service,
@@ -42,6 +44,7 @@ export {
4244
activityBar,
4345
sidebar,
4446
menuBar,
47+
statusBar,
4548
editor,
4649
extension,
4750
theme,

src/services/menuBarService.ts

-37
This file was deleted.

src/services/moleculeService.ts

-50
This file was deleted.

src/services/sidebarService.ts

-31
This file was deleted.

src/services/stateService.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function mapState<S>(WrappedComponent: React.ComponentType<any>, state: S
1515
constructor(props) {
1616
super(props);
1717
this.onChange = this.onChange.bind(this);
18-
this.state = cloneInstance(state);
18+
this.state = state;
1919
}
2020

2121
componentDidMount() {

0 commit comments

Comments
 (0)