By doing something such as opening an offscreen document for audio playback:
function offscreenCreate()
{
chrome.offscreen.createDocument({
url: 'offscreen.html',
reasons: ['AUDIO_PLAYBACK'],
justification: "something"
});
}
I've seen a lot of documentation and such, showcasing the operation (and other operations related to offscreen documents, such as closing them) being used within Service Workers, but are there any significant differences in putting these operations within a Service Worker Vs. outside of a Service Worker (just a regular JS file), such as performance? More specifically, is it necessary in general?