jimmywarting / native-file-system-adapter

File system, based on the spec reference implementation

Home Page:https://jimmywarting.github.io/native-file-system-adapter/example/test.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

alex737876 opened this issue · comments

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?

Yea, are you willing to send a PR?

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