简体   繁体   中英

import jquery.js in service-workers

How can I import jquery in sw.js ( https://github.com/mdn/sw-test/blob/gh-pages/sw.js ) to trigger event? I tried to use importScripts('path to jquery.js'), but I had the problem : "window isn't defined".

不要导入像 jQuery 这样的基于 DOM 的库,因为 Service Worker 没有 DOM,所以没有文档、XMLHttpRequest 等。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM