Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Add onchange consition into one function
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaminus committed Jan 5, 2018
1 parent 43c9009 commit 21541ea
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function activate(context: vscode.ExtensionContext) {
private _onDidChange = new vscode.EventEmitter<vscode.Uri>();

public provideTextDocumentContent(uri: vscode.Uri): string {
return this.createJsPreview();
return this.JsRenderView();
}

get onDidChange(): vscode.Event<vscode.Uri> {
Expand All @@ -49,19 +49,13 @@ export function activate(context: vscode.ExtensionContext) {
this._onDidChange.fire(uri);
}

private createJsPreview() {
let editor = vscode.window.activeTextEditor;
if (!(editor.document.languageId === "javascript")) {
return 'Only .js file is supported';
private JsRenderView() {
let WindowP = vscode.window.activeTextEditor;
if (!(WindowP.document.languageId === "javascript")) {
return "Only .js file is supported";
}
return this.extractSnippet();
}

private extractSnippet(): string {
let editor = vscode.window.activeTextEditor;
let text = editor.document.getText();
let text = WindowP.document.getText();
const svg = js2flowchart.convertCodeToSvg(text);
//return this.snippet(svg);
return `<body>${svg}</body>`;
}
}
Expand Down

0 comments on commit 21541ea

Please sign in to comment.