debt - use Event over EventSource

This commit is contained in:
Johannes Rieken
2015-12-21 10:57:54 +01:00
parent f566d06a41
commit 9c13fee737
8 changed files with 36 additions and 38 deletions

View File

@@ -300,8 +300,8 @@ export class MainThreadEditorsTracker {
onLostFocus: () => this._updateFocusedTextEditor()
};
this._modelService.onModelAdded.add(this._onModelAdded, this, this._toDispose);
this._modelService.onModelRemoved.add(this._onModelRemoved, this, this._toDispose);
this._modelService.onModelAdded(this._onModelAdded, this, this._toDispose);
this._modelService.onModelRemoved(this._onModelRemoved, this, this._toDispose);
this._codeEditorService.onCodeEditorAdd(this._onCodeEditorAdd, this, this._toDispose);
this._codeEditorService.onCodeEditorRemove(this._onCodeEditorRemove, this, this._toDispose);

View File

@@ -552,9 +552,9 @@ export class MainThreadDocuments {
this._modelIsSynced = {};
this._toDispose = [];
modelService.onModelAdded.add(this._onModelAdded, this, this._toDispose);
modelService.onModelRemoved.add(this._onModelRemoved, this, this._toDispose);
modelService.onModelModeChanged.add(this._onModelModeChanged, this, this._toDispose);
modelService.onModelAdded(this._onModelAdded, this, this._toDispose);
modelService.onModelRemoved(this._onModelRemoved, this, this._toDispose);
modelService.onModelModeChanged(this._onModelModeChanged, this, this._toDispose);
this._toDispose.push(eventService.addListener2(FileEventType.FILE_SAVED, (e: LocalFileChangeEvent) => {
this._proxy._acceptModelSaved(e.getAfter().resource);
@@ -595,7 +595,8 @@ export class MainThreadDocuments {
});
}
private _onModelModeChanged(model: EditorCommon.IModel, oldModeId:string): void {
private _onModelModeChanged(event: { model: EditorCommon.IModel; oldModeId: string;}): void {
let {model, oldModeId} = event;
let modelUrl = model.getAssociatedResource();
if (!this._modelIsSynced[modelUrl.toString()]) {
return;