UNPKG

alm

Version:

The best IDE for TypeScript

31 lines (30 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var commands = require("../../commands/commands"); var ui = require("../../ui"); var uix_1 = require("../../uix"); var utils = require("../../../common/utils"); commands.enableLiveDemo.on(function () { var ceditor = uix_1.API.getFocusedCodeEditorIfAny(); if (!ceditor || !utils.isTs(ceditor.editor.filePath)) { ui.notifyWarningNormalDisappear('Your current tab needs to be a TypeScript file'); return; } var filePath = ceditor.editor.filePath; commands.ensureLiveDemoTab.emit({ filePath: filePath }); }); commands.disableLiveDemo.on(function () { commands.closeDemoTab.emit({}); }); commands.enableLiveDemoReact.on(function () { var ceditor = uix_1.API.getFocusedCodeEditorIfAny(); if (!ceditor || !utils.isTsx(ceditor.editor.filePath)) { ui.notifyWarningNormalDisappear('Your current tab needs to be a TypeScript tsx file'); return; } var filePath = ceditor.editor.filePath; commands.ensureLiveDemoReactTab.emit({ filePath: filePath }); }); commands.disableLiveDemoReact.on(function () { commands.closeDemoReactTab.emit({}); });