| OLD | NEW |
| (Empty) |
| 1 self.onmessage = function(e) { | |
| 2 // Worker does two things: | |
| 3 // 1. call createImageBitmap() from the ImageBitmap that is transfered | |
| 4 // from the main thread, which verifies that createImageBitmap(ImageBitmap) | |
| 5 // works on the worker thread. | |
| 6 // 2. send the created ImageBitmap back to the main thread, the | |
| 7 // main thread exam the property of this ImageBitmap to make sure | |
| 8 // the transfer between main and worker thread didn't lose data | |
| 9 createImageBitmap(e.data.data).then(imageBitmap => { | |
| 10 postMessage({data: imageBitmap}, [imageBitmap]); | |
| 11 }); | |
| 12 }; | |
| OLD | NEW |