Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SharedService-sw vs SharedService#223

Answeredbyrhashimoto
uma-uc asked this question inQ&A
Discussion options

Hello,

What is the difference between the two, in what they're attempting to accomplish. Any recommendations of one over the other?

You must be logged in to vote

Both of these demos show how a dedicated Worker can be used to handle requests from multiple tabs/windows, instead of a SharedWorker which may not support certain APIs (such as synchronous OPFS). The details are discussedhere.

The original implementation and demo does use a SharedWorker to set up communications to the shared Worker. This satisfies the goal of allowing the use of APIs that require a Worker. However, using SharedWorker at all, even in this much smaller role, means that it won't work on Android Chrome which still doesn't support SharedWorker. Fortunately, it turns out that the setup role can also be handled with a service worker, whichis supported on all modern browsers (i…

Replies: 1 comment

Comment options

Both of these demos show how a dedicated Worker can be used to handle requests from multiple tabs/windows, instead of a SharedWorker which may not support certain APIs (such as synchronous OPFS). The details are discussedhere.

The original implementation and demo does use a SharedWorker to set up communications to the shared Worker. This satisfies the goal of allowing the use of APIs that require a Worker. However, using SharedWorker at all, even in this much smaller role, means that it won't work on Android Chrome which still doesn't support SharedWorker. Fortunately, it turns out that the setup role can also be handled with a service worker, whichis supported on all modern browsers (including Android Chrome). So that's the difference: SharedService-sw performs setup with a service worker, eliminating the use of SharedWorker entirely.

The SharedService idea has drawn interest for use cases outside this project, but it was originally created to show how AccessHandlePoolVFS could be used from multiple tabs despite allowing only one connection at a time. There is now another example VFS, OPFSCoopSyncVFS (discussedhere), that works similarly to AccessHandlePoolVFS but supports multiple connections so it doesn't need something like SharedService. Anyone considering a SharedService approach to use AccessHandlePoolVFS from multiple tabs should check out OPFSCoopSyncVFS as an alternative.

You must be logged in to vote
0 replies
Answer selected byuma-uc
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@uma-uc@rhashimoto

[8]ページ先頭

©2009-2025 Movatter.jp