提交 aae2fd86 编写于 作者: I isidor

output: receivedOutput is a map

上级 02416a70
......@@ -32,7 +32,7 @@ export class OutputService implements IOutputService {
public _serviceBrand: any;
private receivedOutput: { [channel: string]: string; };
private receivedOutput: Map<string, string>;
private activeChannelId: string;
......@@ -55,7 +55,7 @@ export class OutputService implements IOutputService {
this._onOutputChannel = new Emitter<string>();
this._onActiveOutputChannel = new Emitter<string>();
this.receivedOutput = Object.create(null);
this.receivedOutput = new Map<string, string>();
const channels = this.getChannels();
this.activeChannelId = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, StorageScope.WORKSPACE, channels && channels.length > 0 ? channels[0].id : null);
......@@ -109,8 +109,8 @@ export class OutputService implements IOutputService {
private append(channelId: string, output: string): void {
// Initialize
if (!this.receivedOutput[channelId]) {
this.receivedOutput[channelId] = '';
if (!this.receivedOutput.has(channelId)) {
this.receivedOutput.set(channelId, '');
this._onOutputChannel.fire(channelId); // emit event that we have a new channel
}
......@@ -120,7 +120,7 @@ export class OutputService implements IOutputService {
// Store
if (output) {
this.receivedOutput[channelId] = strings.appendWithLimit(this.receivedOutput[channelId], output, MAX_OUTPUT_LENGTH);
this.receivedOutput.set(channelId, strings.appendWithLimit(this.receivedOutput.get(channelId), output, MAX_OUTPUT_LENGTH));
}
this._onOutput.fire({ output: output, channelId: channelId });
......@@ -131,11 +131,11 @@ export class OutputService implements IOutputService {
}
private getOutput(channelId: string): string {
return this.receivedOutput[channelId] || '';
return this.receivedOutput.get(channelId) || '';
}
private clearOutput(channelId: string): void {
this.receivedOutput[channelId] = '';
this.receivedOutput.set(channelId, '');
this._onOutput.fire({ channelId: channelId, output: null /* indicator to clear output */ });
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册