File tree 1 file changed +13
-5
lines changed
packages/common/src/utils/analytics 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ import delay from '../delay';
5
5
const NEW_SESSION_TIME = 1000 * 60 * 30 ;
6
6
7
7
const getLastTimeEventSent = ( ) => {
8
- const lastTime = localStorage . getItem ( 'csb-last-event-sent' ) ;
8
+ try {
9
+ const lastTime = localStorage . getItem ( 'csb-last-event-sent' ) ;
9
10
10
- if ( lastTime === null ) {
11
+ if ( lastTime === null ) {
12
+ return 0 ;
13
+ }
14
+
15
+ return + lastTime ;
16
+ } catch ( e ) {
11
17
return 0 ;
12
18
}
13
-
14
- return + lastTime ;
15
19
} ;
16
20
17
21
const markLastTimeEventSent = ( ) => {
18
- localStorage . setItem ( 'csb-last-event-sent' , Date . now ( ) . toString ( ) ) ;
22
+ try {
23
+ localStorage . setItem ( 'csb-last-event-sent' , Date . now ( ) . toString ( ) ) ;
24
+ } catch ( e ) {
25
+ console . warn ( e ) ;
26
+ }
19
27
} ;
20
28
21
29
const getAmplitude = async ( ) : Promise < any | false > => {
You can’t perform that action at this time.
0 commit comments