This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports | |
const WebPageTest = require("webpagetest"); | |
const fs = require("fs"); | |
var download = require("download-file"); // Install download-file https://www.npmjs.com/package/download-file | |
const Influx = require("influx"); // Download and install InfluxDB https://v2.docs.influxdata.com/v2.0/get-started/ | |
const influx = new Influx.InfluxDB({ | |
host: "localhost", | |
database: "webpagetest", | |
port: 8086 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function() { | |
var lazyImages = [].slice.call(document.querySelectorAll(".lazy > source")); | |
if ("IntersectionObserver" in window) { | |
console.log("IntersectionObserver is supported. Rock on!"); | |
let lazyImageObserver = new IntersectionObserver( | |
function(entries, observer) { | |
entries.forEach(function(entry) { | |
if (entry.isIntersecting) { | |
let lazyImage = entry.target; |