mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
add ts to demo
This commit is contained in:
1 parent
57f5c44d17
commit
0736b7e4d2
9 files changed
+105
-38
No files matched your search
@@ -19,6 +19,9 @@
|
||||
|
||||
window.consoleLog($console);
|
||||
|
||||
var $typeScript = document.querySelector('#typeScript');
|
||||
$typeScript.checked = getURLParameters(window.location.href).typeScript === 'true';
|
||||
|
||||
var editor = null;
|
||||
require.config({ paths: { vs: './assets/js/vs' } });
|
||||
require(['vs/editor/editor.main'], function () {
|
||||
@@ -54,7 +57,7 @@
|
||||
"\turl: '/assets/sample/video.mp4',",
|
||||
'});',
|
||||
].join('\n'),
|
||||
'javascript',
|
||||
$typeScript.checked ? 'typescript' : 'javascript',
|
||||
),
|
||||
});
|
||||
});
|
||||
@@ -183,7 +186,16 @@
|
||||
function restart() {
|
||||
var libs = encodeURIComponent($lib.value);
|
||||
var code = encodeURIComponent(editor.getValue());
|
||||
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
|
||||
var useTS = $typeScript.checked ? 'true' : 'false';
|
||||
var url =
|
||||
window.location.origin +
|
||||
window.location.pathname +
|
||||
'?libs=' +
|
||||
libs +
|
||||
'&code=' +
|
||||
code +
|
||||
'&typeScript=' +
|
||||
useTS;
|
||||
history.pushState(null, null, url);
|
||||
initApp();
|
||||
}
|
||||
@@ -198,6 +210,11 @@
|
||||
}
|
||||
});
|
||||
|
||||
$typeScript.addEventListener('change', function () {
|
||||
restart();
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
window.addEventListener('error', function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user