Can i call a Method from an external JS File in a ServiceWorker?

后端 未结 1 776
囚心锁ツ
囚心锁ツ 2021-01-28 11:06

Is it possible to call a function from a JavaScript file out of an ServiceWorker?

Directory

root
   static
      js
         servicework         


        
相关标签:
1条回答
  • 2021-01-28 11:39

    You can use importScripts() https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts

    importScripts('https://example.com/script.js');
    
    0 讨论(0)
提交回复
热议问题