Fix the demo file upload option
This commit is contained in:
parent
be21a0dbbb
commit
c0e6866745
|
@ -28,7 +28,8 @@ class RuffleObjectShadow extends HTMLElement {
|
|||
this.ruffle = null;
|
||||
}
|
||||
|
||||
connected() {
|
||||
connectedCallback() {
|
||||
console.log("Welcome to ruffle");
|
||||
//Kick off the SWF download.
|
||||
if (this.params.movie) {
|
||||
fetch(this.params.movie).then(response => {
|
||||
|
@ -94,7 +95,10 @@ class RuffleObjectShadow extends HTMLElement {
|
|||
}
|
||||
}
|
||||
|
||||
window.customElements.define("ruffle-object", RuffleObjectShadow);
|
||||
|
||||
const observer = new MutationObserver(function (mutationsList, observer) {
|
||||
console.log(mutationsList);
|
||||
for (let mutation of mutationsList) {
|
||||
for (let node of mutation.addedNodes) {
|
||||
RuffleObjectShadow.wrap_tree(node);
|
||||
|
@ -102,7 +106,7 @@ const observer = new MutationObserver(function (mutationsList, observer) {
|
|||
}
|
||||
});
|
||||
|
||||
RuffleObjectShadow.wrap_tree(document);
|
||||
observer.observe(document, { childList: true, subtree: true});
|
||||
|
||||
window.customElements.define("ruffle-object", RuffleObjectShadow);
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
RuffleObjectShadow.wrap_tree(document.getElementsByTagName("html")[0]);
|
||||
}, false);
|
||||
observer.observe(document, { childList: true, subtree: true});
|
|
@ -1,5 +1,5 @@
|
|||
import { Ruffle } from "../../pkg/ruffle";
|
||||
import "./element";
|
||||
import { RuffleObjectShadow } from "./element";
|
||||
|
||||
let sampleFileInput = document.getElementById("sample-file");
|
||||
if (sampleFileInput) {
|
||||
|
@ -55,13 +55,5 @@ let timestamp = 0;
|
|||
let animationHandler;
|
||||
|
||||
function playSwf(swfData) {
|
||||
if (ruffle) {
|
||||
ruffle.destroy();
|
||||
ruffle = null;
|
||||
}
|
||||
|
||||
let canvas = document.getElementById("player");
|
||||
if (swfData && canvas) {
|
||||
ruffle = Ruffle.new(canvas, new Uint8Array(swfData));
|
||||
}
|
||||
document.getElementById("player").play_swf(swfData);
|
||||
}
|
Loading…
Reference in New Issue