crm*_*cco 6 javascript timeout throttling google-chrome google-chrome-devtools
我正在尝试研究如何使用Google Chrome DevTools模拟我网站上JavaScript文件的超时.
我可以使用'切换设备模式'来引入限制,但这并不针对特定的脚本.
有没有办法用DevTools做到这一点?
我正在使用Chrome 38.
DevTools 技术作家和开发人员在这里倡导。截至 2018 年 1 月:
尚未测试此代码,但类似的代码可能适用于基于服务工作人员的限制:
self.addEventListener('fetch', event => {
const TARGET = 'example.com';
const DELAY_MS = 1000;
if (event.request.url === TARGET) {
setTimeout(() => {
event.respondWith(caches.match(event.request));
}, DELAY_MS);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1277 次 |
| 最近记录: |