fetch文档:https://developer.mozilla.org/en-US/docs/Web/API/fetch
因为service-worker没有没有运行到普通的环境,普通的node库也用不了,所以需要使用环境方法fetch
fetch('http://example.com/movies.json') .then((response) => response.json()) .then((data) => console.log(data));
manifest中加入(好像也不是太需要)
"host_permissions": [ "http://example.com/" ],
标签:http,service,worker,json,com,fetch From: https://www.cnblogs.com/jqynr/p/17536927.html