mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
Add ts to demo
This commit is contained in:
1 parent
d906a860c9
commit
0e0bdd00dd
3 files changed
+346
-11
No files matched your search
@@ -23,14 +23,33 @@
|
||||
var editor = null;
|
||||
require.config({ paths: { vs: './assets/js/vs' } });
|
||||
require(['vs/editor/editor.main'], function () {
|
||||
editor = monaco.editor.create($codeMirror, {
|
||||
theme: 'vs-dark',
|
||||
model: monaco.editor.createModel(
|
||||
['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
'javascript',
|
||||
),
|
||||
});
|
||||
initApp();
|
||||
var libUri = './assets/ts/artplayer.d.ts';
|
||||
fetch(libUri)
|
||||
.then((res) => res.text())
|
||||
.then((libSource) => {
|
||||
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||
noSemanticValidation: true,
|
||||
noSyntaxValidation: false,
|
||||
});
|
||||
|
||||
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
|
||||
target: monaco.languages.typescript.ScriptTarget.ES6,
|
||||
allowNonTsExtensions: true,
|
||||
});
|
||||
|
||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
|
||||
monaco.editor.createModel(libSource, 'typescript', monaco.Uri.parse(libUri));
|
||||
|
||||
editor = monaco.editor.create($codeMirror, {
|
||||
theme: 'vs-dark',
|
||||
model: monaco.editor.createModel(
|
||||
['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
'javascript',
|
||||
),
|
||||
});
|
||||
|
||||
initApp();
|
||||
});
|
||||
});
|
||||
|
||||
function initArt(art) {
|
||||
|
||||
Reference in new issue
Block a user