Fetch
The Fetch API provides an interface for asynchronously fetching resources via HTTP requests inside of a Worker.
The fetch method is implemented on the ServiceWorkerGlobalScope. Refer to MDN documentation for more information.
 Constructor
addEventListener('fetch', event => {// NOTE: can’t use fetch here, as we’re not in an async scope yetevent.respondWith(eventHandler(event));});async function eventHandler(event) {// fetch can be awaited here since `event.respondWith()` waits for the Promise it receives to settleconst resp = await fetch(event.request);return resp;}
fetch(request, init ):Promise<Response>- Fetch returns a promise to a Response.
 
 Parameters
requestRequest|string- The 
Requestobject or a string represents the URL to fetch. 
- The 
 initRequestInit- The content of the request.