We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9698f64 commit 41ebcfcCopy full SHA for 41ebcfc
1 file changed
examples/server.latency.js
@@ -0,0 +1,31 @@
1
+/**
2
+ *
3
+ * Install:
4
+ * npm install browser-sync
5
6
+ * Run:
7
+ * node <yourfile.js>
8
9
+ * This example will create a server & use the `app` directory as the root
10
+ * - any requests begining with /json will have fake latency applied
11
+ * - for 3 seconds
12
13
+ */
14
+
15
+"use strict";
16
17
+var browserSync = require("browser-sync").create();
18
19
+function fakeLatency (req, res, next) {
20
+ if (req.url.match(/^\/json/)) {
21
+ setTimeout(next, 3000);
22
+ } else {
23
+ next();
24
+ }
25
+}
26
27
+browserSync.init({
28
+ files: ["app/css/*.css"],
29
+ server: "app",
30
+ middleware: [fakeLatency]
31
+});
0 commit comments