replace window.* by self.* in order to support service worker context#271
Conversation
|
A change like this really needs some automated tests around it. More specifically I would like to know if the "addEventListener" methods and things referencing the "self" object are indeed referencing the "window" object in a browser environment. |
|
Hello @travist , thank you for taking some time and read this PR, sure I can add some test in order to cover this change, please let me know which type of test you think is better to implement, also, the |
|
I would love to have this feature as well.
However, I would love to help get it approved if there is anything for me to do. |
This package works perfectly well, but when you use it in a service worker context, it failed because
window.*access is not support by service worker.So in order to support this package into service worker, we should make a little change, replace any
window.*usage byself.*.So self will work for non-window contexts where this code can be executed, so with this change this package can be used into a service worker without any problem 😄 .