comunicconsole/src/ui/widgets/InitWidget.tsx

39 lines
764 B
TypeScript
Raw Normal View History

2021-05-10 19:03:42 +02:00
/**
* Initialization widget
*
* @author Pierre Hubert
*/
import React from "react";
import { AsyncWidget } from "./AsyncWidget";
export class InitWidget extends React.Component {
constructor(props: any) {
super(props);
this.init = this.init.bind(this);
this.build = this.build.bind(this);
}
async init() {
await new Promise((res, rej) => {
setTimeout(() => {
rej(null);
}, 500)
})
}
render() {
return (<AsyncWidget
errorMessage = "Failed to initialize application!"
load = {this.init}
onBuild = {this.build}
></AsyncWidget>);
}
build() {
return (<div>yes !!! done !!!</div>);
}
}