File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,15 +170,15 @@ export class ServiceWorkerMessageSend implements MessageSend {
170170
171171 async init ( ) {
172172 if ( ! this . target && self . clients ) {
173- const list = await self . clients . matchAll ( { includeUncontrolled : true , type : "window" } ) ;
174- // 找到offscreen.html窗口
175- this . target = list . find ( ( client ) => client . url == chrome . runtime . getURL ( "src/offscreen.html" ) ) as PostMessage ;
176173 if ( ! this . listened ) {
177174 this . listened = true ;
178175 self . addEventListener ( "message" , ( e ) => {
179176 this . messageHandle ( e . data ) ;
180177 } ) ;
181178 }
179+ const list = await self . clients . matchAll ( { includeUncontrolled : true , type : "window" } ) ;
180+ // 找到offscreen.html窗口
181+ this . target = list . find ( ( client ) => client . url == chrome . runtime . getURL ( "src/offscreen.html" ) ) as PostMessage ;
182182 }
183183 }
184184
You can’t perform that action at this time.
0 commit comments