66 - It reuses `Vaadin.Flow.clients` if exists.
77 - Fixed lint errors.
88 */
9- const init = function ( appInitResponse ) {
9+ const init = function ( appInitResponse ) {
1010 window . Vaadin = window . Vaadin || { } ;
1111 window . Vaadin . Flow = window . Vaadin . Flow || { } ;
1212
@@ -16,10 +16,10 @@ const init = function(appInitResponse) {
1616 var log ;
1717 if ( typeof window . console === undefined || ! window . location . search . match ( / [ & ? ] d e b u g ( & | $ ) / ) ) {
1818 /* If no console.log present, just use a no-op */
19- log = function ( ) { } ;
19+ log = function ( ) { } ;
2020 } else if ( typeof window . console . log === 'function' ) {
2121 /* If it's a function, use it with apply */
22- log = function ( ) {
22+ log = function ( ) {
2323 window . console . log . apply ( window . console , arguments ) ;
2424 } ;
2525 } else {
@@ -28,7 +28,7 @@ const init = function(appInitResponse) {
2828 log = window . console . log ;
2929 }
3030
31- var isInitializedInDom = function ( appId ) {
31+ var isInitializedInDom = function ( appId ) {
3232 var appDiv = document . getElementById ( appId ) ;
3333 if ( ! appDiv ) {
3434 return false ;
@@ -57,8 +57,8 @@ const init = function(appInitResponse) {
5757 /*
5858 * Needed for wrapping custom javascript functionality in the components (i.e. connectors)
5959 */
60- window . Vaadin . Flow . tryCatchWrapper = function ( originalFunction , component ) {
61- return function ( ) {
60+ window . Vaadin . Flow . tryCatchWrapper = function ( originalFunction , component ) {
61+ return function ( ) {
6262 try {
6363 // eslint-disable-next-line
6464 const result = originalFunction . apply ( this , arguments ) ;
@@ -74,18 +74,19 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
7474 } ;
7575
7676 if ( ! window . Vaadin . Flow . initApplication ) {
77-
7877 window . Vaadin . Flow . clients = window . Vaadin . Flow . clients || { } ;
7978
80- window . Vaadin . Flow . initApplication = function ( appId , config ) {
79+ window . Vaadin . Flow . initApplication = function ( appId , config ) {
8180 var testbenchId = appId . replace ( / - \d + $ / , '' ) ;
8281
8382 if ( apps [ appId ] ) {
84- if ( window . Vaadin
85- && window . Vaadin . Flow
86- && window . Vaadin . Flow . clients
87- && window . Vaadin . Flow . clients [ testbenchId ]
88- && window . Vaadin . Flow . clients [ testbenchId ] . initializing ) {
83+ if (
84+ window . Vaadin &&
85+ window . Vaadin . Flow &&
86+ window . Vaadin . Flow . clients &&
87+ window . Vaadin . Flow . clients [ testbenchId ] &&
88+ window . Vaadin . Flow . clients [ testbenchId ] . initializing
89+ ) {
8990 throw new Error ( 'Application ' + appId + ' is already being initialized' ) ;
9091 }
9192 if ( isInitializedInDom ( appId ) ) {
@@ -96,14 +97,14 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
9697 log ( 'init application' , appId , config ) ;
9798
9899 window . Vaadin . Flow . clients [ testbenchId ] = {
99- isActive : function ( ) {
100+ isActive : function ( ) {
100101 return true ;
101102 } ,
102103 initializing : true ,
103104 productionMode : mode
104105 } ;
105106
106- var getConfig = function ( name ) {
107+ var getConfig = function ( name ) {
107108 var value = config [ name ] ;
108109 return value ;
109110 } ;
@@ -132,7 +133,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
132133
133134 return app ;
134135 } ;
135- window . Vaadin . Flow . getAppIds = function ( ) {
136+ window . Vaadin . Flow . getAppIds = function ( ) {
136137 var ids = [ ] ;
137138 for ( var id in apps ) {
138139 if ( apps . hasOwnProperty ( id ) ) {
@@ -141,10 +142,10 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
141142 }
142143 return ids ;
143144 } ;
144- window . Vaadin . Flow . getApp = function ( appId ) {
145+ window . Vaadin . Flow . getApp = function ( appId ) {
145146 return apps [ appId ] ;
146147 } ;
147- window . Vaadin . Flow . registerWidgetset = function ( widgetset , callback ) {
148+ window . Vaadin . Flow . registerWidgetset = function ( widgetset , callback ) {
148149 log ( 'Widgetset registered' , widgetset ) ;
149150 var ws = widgetsets [ widgetset ] ;
150151 if ( ws && ws . pendingApps ) {
@@ -157,7 +158,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
157158 ws . pendingApps = null ;
158159 }
159160 } ;
160- window . Vaadin . Flow . getBrowserDetailsParameters = function ( ) {
161+ window . Vaadin . Flow . getBrowserDetailsParameters = function ( ) {
161162 var params = { } ;
162163
163164 /* Screen height and width */
@@ -186,8 +187,8 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
186187 date . setUTCMonth ( m ) ;
187188 var tzo2 = date . getTimezoneOffset ( ) ;
188189 if ( tzo1 != tzo2 ) {
189- dstDiff = ( tzo1 > tzo2 ? tzo1 - tzo2 : tzo2 - tzo1 ) ;
190- rawTzo = ( tzo1 > tzo2 ? tzo1 : tzo2 ) ;
190+ dstDiff = tzo1 > tzo2 ? tzo1 - tzo2 : tzo2 - tzo1 ;
191+ rawTzo = tzo1 > tzo2 ? tzo1 : tzo2 ;
191192 break ;
192193 }
193194 }
@@ -202,7 +203,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
202203 params [ 'v-rtzo' ] = rawTzo ;
203204
204205 /* DST in effect? */
205- params [ 'v-dston' ] = ( tzo1 != rawTzo ) ;
206+ params [ 'v-dston' ] = tzo1 != rawTzo ;
206207
207208 /* Time zone id (if available) */
208209 try {
@@ -223,8 +224,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
223224 supportsTouch = true ;
224225 } catch ( e ) {
225226 /* Chrome and IE10 touch detection */
226- supportsTouch = 'ontouchstart' in window
227- || ( typeof navigator . msMaxTouchPoints !== 'undefined' ) ;
227+ supportsTouch = 'ontouchstart' in window || typeof navigator . msMaxTouchPoints !== 'undefined' ;
228228 }
229229 params [ 'v-td' ] = supportsTouch ;
230230
@@ -236,7 +236,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
236236 }
237237
238238 /* Stringify each value (they are parsed on the server side) */
239- Object . keys ( params ) . forEach ( function ( key ) {
239+ Object . keys ( params ) . forEach ( function ( key ) {
240240 var value = params [ key ] ;
241241 if ( typeof value !== 'undefined' ) {
242242 params [ key ] = value . toString ( ) ;
@@ -249,7 +249,7 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
249249 log ( 'Flow bootstrap loaded' ) ;
250250 if ( appInitResponse . appConfig . productionMode && typeof window . __gwtStatsEvent != 'function' ) {
251251 window . Vaadin . Flow . gwtStatsEvents = [ ] ;
252- window . __gwtStatsEvent = function ( event ) {
252+ window . __gwtStatsEvent = function ( event ) {
253253 window . Vaadin . Flow . gwtStatsEvents . push ( event ) ;
254254 return true ;
255255 } ;
@@ -259,5 +259,4 @@ Please submit an issue to https://github.com/vaadin/flow-components/issues/new/c
259259 window . Vaadin . Flow . initApplication ( config . appId , config ) ;
260260} ;
261261
262- export { init } ;
263-
262+ export { init } ;
0 commit comments