mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 18:55:29 -05:00
add app loading splash screen and AppConfig (#279)
* add PyLoader class * create global loader during app creation time and remove it when pyscript loading operations are done * make the loader global and open/close when apps is starting. Also add concept of app config so users can set if they want to autoclose the loader of handle it themselves * add pyconfig file * auto add global config if there's no config set in the page * remove changes to simple_clock example
This commit is contained in:
@@ -8,6 +8,9 @@ import { PyButton } from './components/pybutton';
|
||||
import { PyTitle } from './components/pytitle';
|
||||
import { PyInputBox } from './components/pyinputbox';
|
||||
import { PyWidget } from './components/base';
|
||||
import { PyLoader } from './components/pyloader';
|
||||
import { globalLoader } from './stores';
|
||||
import { PyConfig } from './components/pyconfig';
|
||||
|
||||
const xPyScript = customElements.define('py-script', PyScript);
|
||||
const xPyRepl = customElements.define('py-repl', PyRepl);
|
||||
@@ -17,6 +20,21 @@ const xPyButton = customElements.define('py-button', PyButton);
|
||||
const xPyTitle = customElements.define('py-title', PyTitle);
|
||||
const xPyInputBox = customElements.define('py-inputbox', PyInputBox);
|
||||
const xPyWidget = customElements.define('py-register-widget', PyWidget);
|
||||
const xPyLoader = customElements.define('py-loader', PyLoader);
|
||||
const xPyConfig = customElements.define('py-config', PyConfig);
|
||||
|
||||
|
||||
// As first thing, loop for application configs
|
||||
const config = document.querySelector('py-config');
|
||||
if (!config){
|
||||
const loader = document.createElement('py-config');
|
||||
document.body.append(loader);
|
||||
}
|
||||
|
||||
// add loader to the page body
|
||||
const loader = document.createElement('py-loader');
|
||||
document.body.append(loader);
|
||||
globalLoader.set(loader);
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
||||
|
||||
Reference in New Issue
Block a user