bs-latency
Add artificial latency to defined routes.
Last updated 4 years ago by shakyshane .
MIT · Original npm · Tarball · package.json
$ cnpm install bs-latency 
SYNC missed versions from official npm registry.

bs-latency

Add artificial latency to defined routes.

Install

npm i browser-sync bs-latency

Usage

var bs = require('browser-sync').create();

bs.init({
    server: './app',
    plugins: ['bs-latency']
});

Now access the Plugins section of the UI (address given in the console) & you'll be presented with:

bs-latency

Why use this over the Network Throttle in Browsersync?

Network throttle is a site-wide setting, but sometime you just want to simulate a slow response for certain assets/urls. For example, when developing a gallery feature for a website & you're trying to nail the loading animations and 'waiting' states, it can be helpful to add a short delay to the image request.

Pre-defines routes.

You can add/edit routes in the 'Plugins' section of the UI, but if you want to always begin with some pre-defined ones, configure it like this.

var bs = require('browser-sync').create();

bs.init({
    server:  './app',
    plugins: [{
        module: 'bs-latency',
        options: {
            routes: [
                {
                    route: '/json',
                    latency: 5000,
                    active: true
                }
            ]
        }
    }]
});

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (5)

Copyright 2014 - 2017 © taobao.org |