yyx990803 / register-service-worker

A script to simplify service worker registration with hooks for common events.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is emit undefined in unregister

kopax-polyconseil opened this issue · comments

Hi @yyx990803 and thanks for sharing. I am reading at your code and I try to understand why this is not defined in the function scope :

}).catch(error => handleError(emit, error))

Thanks in advance,

@yyx990803 please also add SW cache removal to unregister function

// Delete SW Cache
if ('caches' in window) {
    caches.keys()
      .then(function(keyList) {
          return Promise.all(keyList.map(function(key) {
              return caches.delete(key);
          }));
      })
}