Skip init function if stylesheet not found
Instead of throwing an error about a member not being defined or accessed on NULL.
This commit is contained in:
committed by
GitHub
parent
b62385c4e0
commit
0d42f65ff6
@@ -10,6 +10,7 @@ const app = new modular({
|
||||
window.onload = (event) => {
|
||||
const $style = document.getElementById('main-css');
|
||||
|
||||
if ($style) {
|
||||
if ($style.isLoaded) {
|
||||
init();
|
||||
} else {
|
||||
@@ -17,6 +18,9 @@ window.onload = (event) => {
|
||||
init();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.warn('The "main-css" stylesheet not found');
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
|
||||
Reference in New Issue
Block a user