do not load ruffle multiple times!

This commit is contained in:
Henry Jameson 2021-04-12 01:15:59 +03:00
parent 6b250762f0
commit 87903fbf6d

View file

@ -2,7 +2,10 @@ const createRuffleService = () => {
let ruffleInstance = null let ruffleInstance = null
const getRuffle = () => new Promise((resolve, reject) => { const getRuffle = () => new Promise((resolve, reject) => {
if (ruffleInstance) resolve(ruffleInstance) if (ruffleInstance) {
resolve(ruffleInstance)
return
}
// Ruffle needs these to be set before it's loaded // Ruffle needs these to be set before it's loaded
// https://github.com/ruffle-rs/ruffle/issues/3952 // https://github.com/ruffle-rs/ruffle/issues/3952
window.RufflePlayer = {} window.RufflePlayer = {}