https://github.com/rmariuzzo/jquery-ajax-latency-simulator-plugin
A jQuery plugin that simulate latency for any AJAX request via jQuery plugin
https://github.com/rmariuzzo/jquery-ajax-latency-simulator-plugin
Last synced: over 1 year ago
JSON representation
A jQuery plugin that simulate latency for any AJAX request via jQuery plugin
- Host: GitHub
- URL: https://github.com/rmariuzzo/jquery-ajax-latency-simulator-plugin
- Owner: rmariuzzo
- Created: 2012-03-01T14:17:16.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2016-03-01T14:48:07.000Z (over 10 years ago)
- Last Synced: 2024-10-11T07:10:56.538Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jQuery AJAX Latency Simulator Plugin
====================================
# Deprecated!
This is a jQuery plugin that simulates HTTP latency when requesting resources using `jQuery.ajax`. This plugin affect all jQuery functions related to AJAX since all of these functions internally use `jQuery.ajax`.
This plugin it is not designed for production use. Instead it was developed to simulate latency when developing a jQuery web application locally, where resources that are requested via AJAX are delivery too fast.
How to use it?
--------------
It should be simple, and it is. It takes one line after including jQuery and the plugin (of course!).
```html
jQuery(function($) {
// All AJAX request will be delayed by 5000 ms.
$.fn.ajaxLatencySimulator({delay : 5000});
});
```
I told you that is just _that simple_.
Any options (aka documentation)?
--------------------------------
You can configure the behaviour of the latency. It could be _linear_ (as in the previous example) or _variable_. The following snippet shows you how to get a _linear_ or a _variable_ latency.
```js
// I would like a linear latency of 3.5 seconds.
$.fn.ajaxLatencySimulator({delay : 3500});
```
```js
// I would like a variable latency from 2 seconds to 6 seconds.
$.fn.ajaxLatencySimulator({min : 2000, max : 6000});
```
And that's all.