[英]How do I Throttle BrowserSync's speed?
How can I configure BrowserSync (from its API) to serve up content at a slower rate? 如何配置BrowserSync(从其API)以较慢的速度提供内容?
Ideally I'd like to be able to serve only certain files at the throttled rate, so when developing, localhost/index.html
loads fast and localhost/dummyData.json
loads slowly, so I can effectively demo loading states while developing web apps that decouple data and presentation. 理想情况下,我希望只能以限制的速度提供某些文件,因此在开发时, localhost/index.html
快速加载,而localhost/dummyData.json
缓慢加载,因此在开发Web应用程序时,我可以有效地演示加载状态分离数据和表示。
browser-sync start --server --files "src/*.*"
启动浏览器同步: browser-sync start --server --files "src/*.*"
HINT: 暗示:
You can run multiple throttled server instances an the same time - eg. 您可以同时运行多个受限制的服务器实例-例如。 to simulate CDN behavior (where the fastest wins) 模拟CDN行为(以最快的速度获胜)
You can also simulate latency! 您还可以模拟延迟! Have a look at the bs-latency Plugin ... 看看bs-latency插件 ...
From documentation 从文档
reloadThrottle reloadThrottle
Emit only the first event during sequential time windows of a specified duration. 在指定持续时间的连续时间窗口内仅发出第一个事件。
Example 例
browserSync.init({
reloadThrottle: 300,
server: {
baseDir: 'dev/'
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.