diff --git a/package-lock.json b/package-lock.json index e489810..939430f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2476,6 +2476,12 @@ } } }, + "express-throttle-bandwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/express-throttle-bandwidth/-/express-throttle-bandwidth-1.0.1.tgz", + "integrity": "sha1-1++YO1Bs422H1TrXur2k22Vtazs=", + "dev": true + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", diff --git a/package.json b/package.json index b713693..78c0620 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@types/jest": "^24.0.13", "codecov": "^3.5.0", "express": "^4.17.1", + "express-throttle-bandwidth": "^1.0.1", "glob-promise": "^4.2.0", "jest": "^24.8.0", "onchange": "^3.3.0", diff --git a/samples/_samplesServer.js b/samples/_samplesServer.js index f1abc34..3694b3b 100644 --- a/samples/_samplesServer.js +++ b/samples/_samplesServer.js @@ -3,6 +3,7 @@ const serveStatic = require('serve-static'); const serveIndex = require('serve-index'); const path = require('path'); const opn = require('open'); +const throttle = require('express-throttle-bandwidth'); // TODO: as indipendent library @@ -12,9 +13,11 @@ const staticBasePath = path.join(__dirname, '..'); const app = express(); +app.use(throttle(10 /* bits per second */)); app.use(serveStatic(staticBasePath, { index: false })); app.use(serveIndex(staticBasePath, { icons: true })); app.listen(PORT); console.log(`Static server listening on port ${PORT}.`); -opn(`http://localhost:${PORT}/samples`); +// TODO: Only if not opened +// !!! opn(`http://localhost:${PORT}/samples`); diff --git a/samples/assets/common.css b/samples/assets/common.css index e69de29..b85cca3 100644 --- a/samples/assets/common.css +++ b/samples/assets/common.css @@ -0,0 +1,3 @@ +img { + max-width: 50vw; +} diff --git a/samples/assets/images/image.svg b/samples/assets/images/image.svg new file mode 100644 index 0000000..ca12327 --- /dev/null +++ b/samples/assets/images/image.svg @@ -0,0 +1,249 @@ + + + + \ No newline at end of file diff --git a/samples/assets/images/simple.png b/samples/assets/images/simple.png new file mode 100644 index 0000000..7d15fd1 Binary files /dev/null and b/samples/assets/images/simple.png differ diff --git a/samples/forAllImagesInElement.html b/samples/forAllImagesInElement.html index 2ee1a01..6a8da43 100644 --- a/samples/forAllImagesInElement.html +++ b/samples/forAllImagesInElement.html @@ -6,7 +6,8 @@
- + +