File tree Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ self.onconnect = (e) => {
87
87
// How this has happened I don't understand...
88
88
// deregister from that source
89
89
const count = source . deregister ( port ) ;
90
- // Clean-up
90
+ // Clean-up
91
91
if ( count === 0 ) {
92
92
source . close ( ) ;
93
93
sourcesByUrl [ source . url ] = null ;
@@ -98,11 +98,9 @@ self.onconnect = (e) => {
98
98
source . register ( port ) ;
99
99
sourcesByUrl [ url ] = source ;
100
100
sourcesByPort [ port ] = source ;
101
- return ;
102
101
} else if ( event . data . type === 'listen' ) {
103
102
const source = sourcesByPort [ port ] ;
104
103
source . listen ( event . data . eventType ) ;
105
- return ;
106
104
} else if ( event . data . type === 'close' ) {
107
105
const source = sourcesByPort [ port ] ;
108
106
@@ -114,7 +112,6 @@ self.onconnect = (e) => {
114
112
sourcesByUrl [ source . url ] = null ;
115
113
sourcesByPort [ port ] = null ;
116
114
}
117
- return ;
118
115
} else if ( event . data . type === 'status' ) {
119
116
const source = sourcesByPort [ port ] ;
120
117
if ( ! source ) {
@@ -125,14 +122,12 @@ self.onconnect = (e) => {
125
122
return ;
126
123
}
127
124
source . status ( port ) ;
128
- return ;
129
125
} else {
130
126
// just send it back
131
127
port . postMessage ( {
132
128
type : 'error' ,
133
129
message : `received but don't know how to handle: ${ event . data } ` ,
134
130
} ) ;
135
- return ;
136
131
}
137
132
} ) ;
138
133
port . start ( ) ;
Original file line number Diff line number Diff line change @@ -57,29 +57,24 @@ export async function initNotificationCount() {
57
57
type : 'start' ,
58
58
url : `${ window . location . origin } ${ AppSubUrl } /user/events` ,
59
59
} ) ;
60
- worker . port . addEventListener ( 'message' , ( e ) => {
61
- if ( ! e . data || ! e . data . type ) {
62
- console . error ( e ) ;
60
+ worker . port . addEventListener ( 'message' , ( event ) => {
61
+ if ( ! event . data || ! event . data . type ) {
62
+ console . error ( event ) ;
63
63
return ;
64
64
}
65
65
if ( event . data . type === 'notification-count' ) {
66
- receiveUpdateCount ( e . data ) ;
67
- return ;
66
+ receiveUpdateCount ( event . data ) ;
68
67
} else if ( event . data . type === 'error' ) {
69
- console . error ( e . data ) ;
70
- return ;
68
+ console . error ( event . data ) ;
71
69
} else if ( event . data . type === 'logout' ) {
72
- if ( e . data !== 'here' ) {
70
+ if ( event . data !== 'here' ) {
73
71
return ;
74
72
}
75
73
worker . port . postMessage ( {
76
74
type : 'close' ,
77
75
} ) ;
78
76
worker . port . close ( ) ;
79
77
window . location . href = AppSubUrl ;
80
- return ;
81
- } else {
82
- return ;
83
78
}
84
79
} ) ;
85
80
worker . port . addEventListener ( 'error' , ( e ) => {
You can’t perform that action at this time.
0 commit comments