jimmywarting / native-file-system-adapter

File system, based on the spec reference implementation
https://jimmywarting.github.io/native-file-system-adapter/example/test.html
MIT License
480 stars 43 forks source link

Update sw example (chromium now supports cancel event notifications to service workers) #65

Open alex737876 opened 1 year ago

alex737876 commented 1 year ago

In the /master/example/sw.js cancel() method:

/** @param {Error} reason */  
  cancel (reason) {  
    // Firefox can notify a cancel event, chrome can't  
    // https://bugs.chromium.org/p/chromium/issues/detail?id=638494  
    this.port.postMessage({ type: ERROR, reason: reason.message })  
    this.port.close()  
  }

There is a link to a chromium bug, that is fixed now (since Jan 2022). Maybe the example sw could now be simplified?

jimmywarting commented 1 year ago

Yea, are you willing to send a PR?

alex737876 commented 1 year ago

Yes, right now im struggling to get the service worker running, so that i can try removing that "cancel() function". Its downloading everything into memory before opening a file save dialog on iOS. But ive placed the script not in src root, that i will try next. To keep you posted