File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ export const WebWorker = (ChosenHTMLElement = HTMLElement) => class WebWorker ex
4141 func = func . replace ( / t h i s \. / g, '' )
4242 func = func . replace ( new RegExp ( `${ this . constructor . name } \\.` , 'g' ) , '' )
4343 func = / ^ .* ?= > .* ?/ . test ( func ) ? `(${ func } )` : ! / ^ f u n c t i o n / . test ( func ) ? `function ${ func } ` : func
44- const response = `onmessage=(event)=>{postMessage(${ func } (...event.data))}`
44+ func = func . replace ( / ( .* ) a s y n c \s ( .* ) / s, 'await async $1$2' ) // fix async function
45+ func = func . replace ( / f u n c t i o n \s # / , 'function ' ) // fix private functions
46+ const response = `onmessage=async (event)=>{postMessage(${ func } (...event.data))}`
4547 let blob
4648 try {
4749 blob = new Blob ( [ response ] , { type : 'application/javascript' } )
You can’t perform that action at this time.
0 commit comments