mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-06-23 21:19:30 +02:00
50476d1002
+ yarn lint:check - to check code styling + yarn lint:fix - to fix code styling
38 lines
695 B
JavaScript
38 lines
695 B
JavaScript
import $ from 'jquery';
|
|
|
|
import Events from './_events';
|
|
// import an example component
|
|
import Spinner from './_components/_spinner';
|
|
|
|
const MainUI = (($) => {
|
|
// Constants
|
|
const NAME = 'MainUI';
|
|
|
|
class MainUI {
|
|
// Static methods
|
|
static init() {
|
|
this.destroy();
|
|
console.log(`Initializing: ${NAME}`);
|
|
|
|
Spinner.hide(() => {
|
|
$('body').addClass('loaded');
|
|
});
|
|
}
|
|
|
|
static destroy() {
|
|
console.log(`Destroying: ${NAME}`);
|
|
Spinner.show(() => {
|
|
$('body').removeClass('loaded');
|
|
});
|
|
}
|
|
}
|
|
|
|
$(window).on(`${Events.AJAX} ${Events.LOADED}`, () => {
|
|
MainUI.init();
|
|
});
|
|
|
|
return MainUI;
|
|
})($);
|
|
|
|
export default MainUI;
|