File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,10 @@ class Gleap {
365365 GleapSession . getInstance ( ) . useCookies = useCookies ;
366366 }
367367
368+ static disableLocalStorage ( ) {
369+ GleapSession . getInstance ( ) . localStorageDisabled = true ;
370+ }
371+
368372 /**
369373 * Indentifies the user session
370374 * @param {string } userId
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export default class GleapSession {
2424 sdkKey = null ;
2525 updatingSession = false ;
2626 useCookies = true ;
27+ localStorageDisabled = false ;
2728 session = {
2829 gleapId : null ,
2930 gleapHash : null ,
@@ -171,7 +172,9 @@ export default class GleapSession {
171172 GleapEventManager . notifyEvent ( 'unregister-pushmessage-group' , `gleapuser-${ this . session . gleapHash } ` ) ;
172173 }
173174
174- saveToGleapCache ( `session-${ this . sdkKey } ` , session ) ;
175+ if ( ! this . localStorageDisabled ) {
176+ saveToGleapCache ( `session-${ this . sdkKey } ` , session ) ;
177+ }
175178 if ( this . useCookies ) {
176179 setGleapCookie ( `session-${ this . sdkKey } ` , encodeURIComponent ( JSON . stringify ( session ) ) , 365 ) ;
177180 }
@@ -224,7 +227,7 @@ export default class GleapSession {
224227 } catch ( exp ) { }
225228
226229 // Try to load session from local storage, if not already loaded.
227- if ( ! ( this . session && this . session . gleapId && this . session . gleapId . length > 0 ) ) {
230+ if ( ! this . localStorageDisabled && ! ( this . session && this . session . gleapId && this . session . gleapId . length > 0 ) ) {
228231 const cachedSession = loadFromGleapCache ( `session-${ this . sdkKey } ` ) ;
229232 if ( cachedSession ) {
230233 this . validateSession ( cachedSession ) ;
You can’t perform that action at this time.
0 commit comments