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 56
56
let workerUrl
57
57
58
58
// Worker code that should be inlined (can't use any external functions)
59
- function code ( ) {
59
+ const code = ( ) => {
60
60
let fileHandle , handle
61
61
62
62
onmessage = async evt => {
96
96
globalThis . FileSystemFileHandle . prototype . createWritable = async function ( options ) {
97
97
// Safari only support writing data in a worker with sync access handle.
98
98
if ( ! workerUrl ) {
99
- const blob = new Blob ( [ code . toString ( ) + `;${ code . name } ();` ] , {
99
+ const stringCode = `(${ code . toString ( ) } )()`
100
+ const blob = new Blob ( [ stringCode ] , {
100
101
type : 'text/javascript'
101
102
} )
102
103
workerUrl = URL . createObjectURL ( blob )
123
124
// So we need to pass the path to the worker. This is a bit hacky and ugly.
124
125
const root = await navigator . storage . getDirectory ( )
125
126
const parent = await wm . get ( this )
126
- const path = await parent . resolve ( root )
127
+ const path = await root . resolve ( parent )
127
128
128
129
// Should likely never happen, but just in case...
129
130
if ( path === null ) throw new DOMException ( ...GONE )
You can’t perform that action at this time.
0 commit comments