Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle DOM elements for service worker #506

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

xiazhvera
Copy link
Contributor

@xiazhvera xiazhvera commented Nov 21, 2023

Issue #, if available:

Description of changes:

The polyfills is a workaround to introduce node APIs such as buffer and process in all javascript environments. In our original design, we set it up through window by window.Buffer = buffer.Buffer;.
However, window only exits in browser. In some of the javascript environments like service worker, the polypill would not work as window would not exit there.
Therefore, we change it to self. self gives us access to the global scope regardless of browser context. For example in the DOM, self would return window, while in a service worker self will return ServiceWorkerGlobalScope.
The fix should be able to bind the Buffer and process polyfills.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@xiazhvera xiazhvera marked this pull request as ready for review November 21, 2023 17:29
@xiazhvera xiazhvera marked this pull request as draft November 21, 2023 17:40
@xiazhvera xiazhvera marked this pull request as ready for review April 23, 2024 17:58
@xiazhvera xiazhvera mentioned this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant