page loader

This commit is contained in:
bkfox
2023-11-29 02:05:14 +01:00
parent 4e04cfae7e
commit f5ce00795e
8 changed files with 270 additions and 204 deletions

View File

@@ -8,7 +8,7 @@ import '@fortawesome/fontawesome-free/css/all.min.css';
//-- aircox
import App, {PlayerApp} from './app'
import Builder from './appBuilder'
import VueLoader from './vueLoader'
import Sound from './sound'
import {Set} from './model'
@@ -17,13 +17,13 @@ import './assets/styles.scss'
window.aircox = {
// main application
builder: new Builder(App),
get app() { return this.builder.app },
loader: null,
get app() { return this.loader.app },
// player application
playerBuilder: new Builder(PlayerApp),
get playerApp() { return this.playerBuilder && this.playerBuilder.app },
get player() { return this.playerBuilder.vm && this.playerBuilder.vm.$refs.player },
playerLoader: null,
get playerApp() { return this.playerLoader && this.playerLoader.app },
get player() { return this.playerLoader.vm && this.playerLoader.vm.$refs.player },
Set, Sound,
@@ -31,27 +31,23 @@ window.aircox = {
/**
* Initialize main application and player.
*/
init(props=null, {config=null, builder=null, initBuilder=true,
initPlayer=true, hotReload=false, el=null}={})
init(props=null, {hotReload=false, el=null,
config=null, playerConfig=null,
initApp=true, initPlayer=true,
loader=null, playerLoader=null}={})
{
if(initPlayer) {
let playerBuilder = this.playerBuilder
playerBuilder.mount()
playerConfig = playerConfig || PlayerApp
playerLoader = playerLoader || new VueLoader(playerConfig)
playerLoader.enable(false)
this.playerLoader = playerLoader
}
if(initBuilder) {
builder = builder || this.builder
this.builder = builder
if(config || window.App)
builder.config = config || window.App
if(el)
builder.config.el = el
builder.title = document.title
builder.mount({props})
if(hotReload)
builder.enableHotReload(hotReload)
if(initApp) {
config = config || window.App || App
loader = loader || new VueLoader({el, props, ...config})
loader.enable(hotReload)
this.loader = loader
}
},