但我使用生产模式编译后就不能访问到我定义的方法或变量了。。所以我应该怎么做?
import * as monaco from 'monaco-editor';
import './index.css';
const axios = require('axios') ;
let editor= monaco.editor.create(document.body, {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'typescript',
theme:'vs-dark'
});
//这是我要在.NET浏览器使用调用的方法 但使用生产模式编译后我无法访问到这个方法名了。。。
let GetText = function():string {
return editor.getValue();
}
console.log(GetText());
所以我如何才能在浏览器控制台调用 GetText() 方法
简单暴力,直接把他赋予给window对象
import * as monaco from 'monaco-editor';
import './index.css';
const axios = require('axios') ;
let editor= monaco.editor.create(document.body, {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'typescript',
theme:'vs-dark'
});
//这是我要在.NET浏览器使用调用的方法 但使用生产模式编译后我无法访问到这个方法名了。。。
let GetText = function():string {
return editor.getValue();
}
window.GetText=GetText
console.log(GetText());