[英]Can i call a Method from an external JS File in a ServiceWorker?
Is it possible to call a function from a JavaScript file out of an ServiceWorker? 是否可以从ServiceWorker的JavaScript文件中调用函数?
Directory 目录
root
static
js
serviceworker.js
tmpBuild
js
pages
Overview.js
serviceworker.js has to call a method from Overview.js ! serviceworker.js必须从Overview.js调用方法! Is that possible?
那可能吗? And How?
如何?
您可以使用importScripts() https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts
importScripts('https://example.com/script.js');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.