@@ -21,12 +21,7 @@ const DEFAULT_PROPS = {
2121
2222const STATELESS_PROPS = [ 'appId' , 'apiKey' , 'domain' ]
2323
24- const root = (
25- ( typeof self === 'object' && self . self === self && self ) ||
26- ( typeof global === 'object' && global . global === global && global )
27- )
28-
29- const previousBackendless = root && root . Backendless
24+ const previousBackendless = Utils . globalScope && Utils . globalScope . Backendless
3025
3126const showLegacyDataWarning = ( ) => {
3227 if ( ! showLegacyDataWarning . isShown ) {
@@ -173,6 +168,15 @@ class Backendless {
173168 this . __appInfoPromise = new Promise ( ( resolve , reject ) => {
174169 this . request . get ( { url : this . urls . appInfo ( ) } )
175170 . then ( resolve )
171+ . catch ( error => {
172+ if ( error . code === 3064 ) {
173+ this . setCurrentUserToken ( null )
174+
175+ return this . request . get ( { url : this . urls . appInfo ( ) } )
176+ }
177+
178+ throw error
179+ } )
176180 . catch ( reject )
177181 } )
178182 }
@@ -379,8 +383,8 @@ class Backendless {
379383 }
380384
381385 noConflict ( ) {
382- if ( root ) {
383- root . Backendless = previousBackendless
386+ if ( Utils . globalScope ) {
387+ Utils . globalScope . Backendless = previousBackendless
384388 }
385389
386390 return this
@@ -572,8 +576,8 @@ class Backendless {
572576
573577const backendless = new Backendless ( DEFAULT_PROPS )
574578
575- if ( root ) {
576- root . Backendless = backendless
579+ if ( Utils . globalScope ) {
580+ Utils . globalScope . Backendless = backendless
577581}
578582
579583exports = module . exports = backendless
0 commit comments