File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 5656 let workerUrl
5757
5858 // Worker code that should be inlined (can't use any external functions)
59- function code ( ) {
59+ const code = ( ) => {
6060 let fileHandle , handle
6161
6262 onmessage = async evt => {
9696 globalThis . FileSystemFileHandle . prototype . createWritable = async function ( options ) {
9797 // Safari only support writing data in a worker with sync access handle.
9898 if ( ! workerUrl ) {
99- const blob = new Blob ( [ code . toString ( ) + `;${ code . name } ();` ] , {
99+ const stringCode = `(${ code . toString ( ) } )()`
100+ const blob = new Blob ( [ stringCode ] , {
100101 type : 'text/javascript'
101102 } )
102103 workerUrl = URL . createObjectURL ( blob )
123124 // So we need to pass the path to the worker. This is a bit hacky and ugly.
124125 const root = await navigator . storage . getDirectory ( )
125126 const parent = await wm . get ( this )
126- const path = await parent . resolve ( root )
127+ const path = await root . resolve ( parent )
127128
128129 // Should likely never happen, but just in case...
129130 if ( path === null ) throw new DOMException ( ...GONE )
You can’t perform that action at this time.
0 commit comments