33 * it is possible to load EASYUI asynchronously.
44 * jquery node_module working with ProvidePlugin.
55 */
6- import MobileDetect from 'mobile-detect' ;
76const CodeMirror = ( await import ( 'codemirror' ) ) . default ;
87
98import { Observable } from './patterns/observable' ;
@@ -72,7 +71,7 @@ export class BootLoader implements IBootLoader {
7271 }
7372 } catch ( err ) {
7473 console . error ( `Error occurred: ${ err } ` ) ;
75- reject ( Error ( err ) ) ;
74+ reject ( new Error ( err ) ) ;
7675 }
7776 } ) ;
7877 }
@@ -97,20 +96,6 @@ export class BootLoader implements IBootLoader {
9796 return this . promisify ( setTimeout , delay ) ;
9897 }
9998
100- /**
101- * Checks if running device is mobile device.
102- *
103- * @returns - Flag indicating a Mobile device
104- */
105- platformInfo ( ) : any {
106- // Not reliable -> overridden in app
107- let md = new MobileDetect ( navigator . userAgent ) ;
108- let mobile = md . mobile ( ) != null ;
109- let osFamily = md . os ( ) ?? 'desktop' ;
110-
111- return { isMobile : mobile , osFamily : osFamily } ;
112- }
113-
11499 /**
115100 * Initializes the app.
116101 *
@@ -121,7 +106,7 @@ export class BootLoader implements IBootLoader {
121106 async initApp ( ) {
122107 try {
123108 this . vme = this . factory ( ) ;
124- window . vme = this . vme ; // prevents garbage collection?
109+ globalThis . vme = this . vme ; // prevents garbage collection?
125110 await this . vme . initialise ( ) ;
126111 $ ( '#myContainer' ) . layout ( { fit : true } ) ; // TODO: move to initialise, can be better controlled
127112 $ ( '#innerLayout' ) . layout ( { fit : true } ) ;
@@ -170,7 +155,7 @@ export class BootLoader implements IBootLoader {
170155 */
171156 function checkTypeByName ( type : any , name : string , readableName = name ) {
172157 lastChecked = readableName ;
173- if ( type === undefined || type === null || ( typeof type ) === 'undefined' || ! type . prototype ) {
158+ if ( ! type ? .prototype ) {
174159 console . warn ( `Undefined type : ${ readableName } ` ) ;
175160 return false ;
176161 }
@@ -202,7 +187,7 @@ export class BootLoader implements IBootLoader {
202187 function mhchemCheck ( ) {
203188 try {
204189 lastChecked = "Mhchem" ;
205- this . katex . renderToString ( "\\ ce{SO4^2- + Ba^2+ -> BaSO4 v} " , { throwOnError : true } ) ;
190+ this . katex . renderToString ( String . raw `\ ce{SO4^2- + Ba^2+ -> BaSO4 v} ` , { throwOnError : true } ) ;
206191 return true ;
207192 } catch ( e ) {
208193 console . warn ( `Presence check failed : Mhchem` ) ;
@@ -212,15 +197,9 @@ export class BootLoader implements IBootLoader {
212197
213198 let allLoaded = (
214199 checkOther ( typeof $ , 'function' , 'jquery' ) &&
215- //checkOther(typeof $.messager, 'object', 'easyui') &&
216- //checkOther(typeof $.fn.datagrid, 'function', 'datagrid') &&
217- //checkOther(typeof $.fn.datagrid.defaults, 'object', 'datagrid') &&
218- //checkOther(typeof $.fn.datagrid.defaults.defaultFilterOptions, 'object', 'datagrid-filter') &&
219- // Can we independantly check dnd and cellediting?
200+
220201 checkOther ( typeof this . katex , 'object' , 'Katex' ) &&
221202 checkOther ( typeof this . katex . renderToString , 'function' , 'Katex' ) &&
222- // Can we do this check?
223- //mhchemCheck() &&
224203
225204 checkTypeByName ( CodeMirror , 'CodeMirror' , 'CodeMirror' ) &&
226205
@@ -236,7 +215,7 @@ export class BootLoader implements IBootLoader {
236215 checkTypeByName ( KatexInputHelper , 'KatexInputHelper' ) ) ;
237216
238217 if ( ! allLoaded && cycle <= 0 ) {
239- throw Error ( `${ lastChecked } not loaded` ) ;
218+ throw new Error ( `${ lastChecked } not loaded` ) ;
240219 }
241220
242221 return allLoaded ;
0 commit comments