fix(iframe): [PKG-IFRAME-05] checkpoint player and editor integration

This commit is contained in:
Harvey Zhao committed 2026-09-13 02:17:44 +08:00
1 parent 047e2df945
commit b35183c7af
15 files changed
+2547 -14

No files matched your search

+8
View File
@@ -15,6 +15,11 @@ const iframe = new ArtplayerToolIframe({
url: '/iframe.html',
})
window.addEventListener('artplayer:example:cleanup', () => {
iframe.destroy()
$iframe.remove()
}, { once: true })
iframe.message(({ type, data }) => {
switch (type) {
case 'fullscreenWeb':
@@ -44,4 +49,7 @@ iframe.commit(() => {
data: state,
})
})
}).catch((error) => {
if (!iframe.destroyed)
console.error(error)
})
+2 -1
View File
@@ -205,8 +205,9 @@
}
function runCode() {
window.dispatchEvent(new Event('artplayer:example:cleanup'))
// Destroy all existing instances
Artplayer.instances.forEach((art) => art.destroy(true))
Artplayer.instances.slice().forEach((art) => art.destroy(true))
const value = editor.getValue()
eval(value)
+7 -2
View File
@@ -229,12 +229,17 @@
<div class="popinner"></div>
</div>
<script src="./assets/js/console.js"></script>
<script src="./assets/js/vs/loader.js"></script>
<script>
var artplayer = document.createElement('script');
var monacoLoader = document.createElement('script');
var common = document.createElement('script');
artplayer.onload = function () {
monacoLoader.src = "./assets/js/vs/loader.js";
document.body.appendChild(monacoLoader);
}
monacoLoader.onload = function () {
common.src = "./assets/js/common.js";
document.body.appendChild(common);
}
@@ -274,4 +279,4 @@
</script>
</body>
</html>
</html>