perfops-rom
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -18,2 +18,6 @@ "use strict"; | ||
var globalResults = []; | ||
var resolvers = []; | ||
var done = false; | ||
function fetch(url) { | ||
@@ -138,4 +142,4 @@ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
"data": [{ | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 15, | ||
"cdnUrl": "https://perfstack.qtlglb.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -147,6 +151,2 @@ }, { | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 11, | ||
@@ -156,10 +156,14 @@ "cdnUrl": "https://perfops.b-cdn.net/500b-bench.jpg", | ||
}, { | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/500b-bench.jpg", | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"id": 14, | ||
"cdnUrl": "https://perfops.r.worldssl.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 5, | ||
@@ -169,8 +173,8 @@ "cdnUrl": "https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg", | ||
}, { | ||
"id": 18, | ||
"cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"id": 16, | ||
"cdnUrl": "https://19405s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "1" | ||
@@ -186,26 +190,30 @@ }, { | ||
}, { | ||
"id": 14, | ||
"cdnUrl": "https://perfops.r.worldssl.net/500b-bench.jpg", | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 16, | ||
"cdnUrl": "https://19405s.ha.azioncdn.net/500b-bench.jpg", | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"id": 18, | ||
"cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 15, | ||
"cdnUrl": "https://perfstack.qtlglb.com/500b-bench.jpg", | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 25, | ||
"cdnUrl": "https://perf.gamepiper.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 9, | ||
@@ -215,6 +223,2 @@ "cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
}, { | ||
"id": 25, | ||
"cdnUrl": "https://perf.gamepiper.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 20, | ||
@@ -224,8 +228,8 @@ "cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
}, { | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -243,2 +247,4 @@ }] | ||
return fetchResource(resource).then(function (data) { | ||
globalResults.push(data); | ||
if (!data.up) { | ||
@@ -274,3 +280,8 @@ down++; | ||
}); | ||
}).then(logInfo, logError); | ||
}).then(logInfo, logError).then(function () { | ||
done = true; | ||
resolvers.forEach(function (resolve) { | ||
return resolve(globalResults); | ||
}); | ||
}); | ||
}, 1000); | ||
@@ -311,2 +322,13 @@ } | ||
}); | ||
window.perfopsRumJs = { | ||
getResults: function getResults() { | ||
return new Promise(function (resolve) { | ||
if (done) { | ||
return resolve(globalResults); | ||
} | ||
resolvers.push(resolve); | ||
}); | ||
} | ||
}; | ||
})(window.Promise); |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(a){var n,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},e=t.logInfo,u=t.logError;function o(r,n){var t=1<arguments.length&&void 0!==n?n:{},e=t.cb,c=void 0===e?function(){}:e,o=t.data,p=t.method,d=void 0===p?"GET":p,i=t.timeout,s=void 0===i?3e3:i;return new a(function(n,t){var e=new XMLHttpRequest;e.onload=function(){if(200<=e.status&&e.status<300)return n(e);e.onerror()},e.onerror=e.ontimeout=function(){u(e),t(new Error("Status ".concat(e.status,". Response: ").concat(e.statusText)))},e.open(d,r),e.timeout=s,c(e),e.send(o)})}function r(){setTimeout(function(){o("https://api.perfops.net/rum-cdn.php").then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return n}).catch(function(){return{data:[{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:16,cdnUrl:"https://19405s.ha.azioncdn.net/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:15,cdnUrl:"https://perfstack.qtlglb.com/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:25,cdnUrl:"https://perf.gamepiper.com/500b-bench.jpg",p:"0"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"}]}}).then(function(n){var t=[],e={ua:navigator.userAgent},r=0,c=0;return function(n,r){return n.reduce(function(n,e){return n.then(function(t){return r(e).then(function(n){return t.push(n),t})})},a.resolve([]))}(n.data,function(n){return function(e){var r="".concat(e.cdnUrl,"?t=").concat(Date.now());return o(r).then(function(n){var t=performance.getEntriesByName(r)[0];return{id:e.id,up:1,time:Number((t.duration-(t.domainLookupEnd-t.domainLookupStart)-(t.connectEnd-t.connectStart)).toFixed(2)),headers:n.getAllResponseHeaders()}}).catch(function(){return{id:e.id,up:0}})}(n).then(function(n){if(n.up?2e3<n.time&&r++:c++,!(1<c||n.up&&(n.time<3||3e3<n.time)))return 2<=t.push(n)?(c=0,r<2?(r=0,p(e,t.splice(0,t.length))):(r=0,t.splice(0,t.length))):void 0})}).then(function(){if(c<=1&&t.length)return p(e,t)})}).then(e,u)},1e3)}function p(n,t){return o("https://devnull.perfops.net/rum/v1",{data:JSON.stringify({metadata:n,data:t}),method:"POST"}).catch(u)}n=function(){if(void 0!==window.performance)return"function"==typeof a?r():void function(n,t){var e,r=document.createElement("script");r.onreadystatechange=r.onload=function(){e||t(),e=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){a=window.ES6Promise,r()})},"complete"===document.readyState?n():window.addEventListener("load",n)}(window.Promise); | ||
"use strict";!function(u){var n,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},e=t.logInfo,a=t.logError,o=[],r=[],c=!1;function p(r,n){var t=1<arguments.length&&void 0!==n?n:{},e=t.cb,c=void 0===e?function(){}:e,o=t.data,p=t.method,i=void 0===p?"GET":p,d=t.timeout,s=void 0===d?3e3:d;return new u(function(n,t){var e=new XMLHttpRequest;e.onload=function(){if(200<=e.status&&e.status<300)return n(e);e.onerror()},e.onerror=e.ontimeout=function(){a(e),t(new Error("Status ".concat(e.status,". Response: ").concat(e.statusText)))},e.open(i,r),e.timeout=s,c(e),e.send(o)})}function i(){setTimeout(function(){p("https://api.perfops.net/rum-cdn.php").then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return n}).catch(function(){return{data:[{id:15,cdnUrl:"https://perfstack.qtlglb.com/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:16,cdnUrl:"https://19405s.ha.azioncdn.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:25,cdnUrl:"https://perf.gamepiper.com/500b-bench.jpg",p:"0"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"}]}}).then(function(n){var t=[],e={ua:navigator.userAgent},r=0,c=0;return function(n,r){return n.reduce(function(n,e){return n.then(function(t){return r(e).then(function(n){return t.push(n),t})})},u.resolve([]))}(n.data,function(n){return function(e){var r="".concat(e.cdnUrl,"?t=").concat(Date.now());return p(r).then(function(n){var t=performance.getEntriesByName(r)[0];return{id:e.id,up:1,time:Number((t.duration-(t.domainLookupEnd-t.domainLookupStart)-(t.connectEnd-t.connectStart)).toFixed(2)),headers:n.getAllResponseHeaders()}}).catch(function(){return{id:e.id,up:0}})}(n).then(function(n){if(o.push(n),n.up?2e3<n.time&&r++:c++,!(1<c||n.up&&(n.time<3||3e3<n.time)))return 2<=t.push(n)?(c=0,r<2?(r=0,d(e,t.splice(0,t.length))):(r=0,t.splice(0,t.length))):void 0})}).then(function(){if(c<=1&&t.length)return d(e,t)})}).then(e,a).then(function(){c=!0,r.forEach(function(n){return n(o)})})},1e3)}function d(n,t){return p("https://devnull.perfops.net/rum/v1",{data:JSON.stringify({metadata:n,data:t}),method:"POST"}).catch(a)}n=function(){if(void 0!==window.performance)return"function"==typeof u?i():void function(n,t){var e,r=document.createElement("script");r.onreadystatechange=r.onload=function(){e||t(),e=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){u=window.ES6Promise,i()})},"complete"===document.readyState?n():window.addEventListener("load",n),window.perfopsRumJs={getResults:function(){return new u(function(n){if(c)return n(o);r.push(n)})}}}(window.Promise); |
@@ -18,2 +18,6 @@ "use strict"; | ||
var globalResults = []; | ||
var resolvers = []; | ||
var done = false; | ||
function fetch(url) { | ||
@@ -138,4 +142,4 @@ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
"data": [{ | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 15, | ||
"cdnUrl": "https://perfstack.qtlglb.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -147,6 +151,2 @@ }, { | ||
}, { | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 11, | ||
@@ -156,10 +156,14 @@ "cdnUrl": "https://perfops.b-cdn.net/500b-bench.jpg", | ||
}, { | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/500b-bench.jpg", | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"id": 14, | ||
"cdnUrl": "https://perfops.r.worldssl.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 4, | ||
"cdnUrl": "https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 5, | ||
@@ -169,8 +173,8 @@ "cdnUrl": "https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg", | ||
}, { | ||
"id": 18, | ||
"cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"id": 16, | ||
"cdnUrl": "https://19405s.ha.azioncdn.net/500b-bench.jpg", | ||
"p": "1" | ||
@@ -186,26 +190,30 @@ }, { | ||
}, { | ||
"id": 14, | ||
"cdnUrl": "https://perfops.r.worldssl.net/500b-bench.jpg", | ||
"id": 7, | ||
"cdnUrl": "https://googlecdn.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 16, | ||
"cdnUrl": "https://19405s.ha.azioncdn.net/500b-bench.jpg", | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 1, | ||
"cdnUrl": "https://kgmni17536myjst.belugacdn.link/500b-bench.jpg", | ||
"id": 18, | ||
"cdnUrl": "https://azure-perfops.azureedge.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 15, | ||
"cdnUrl": "https://perfstack.qtlglb.com/500b-bench.jpg", | ||
"id": 10, | ||
"cdnUrl": "https://akamai.perfstack.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 12, | ||
"cdnUrl": "https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg", | ||
"id": 3, | ||
"cdnUrl": "https://perfops.perfstack.cf-china.info/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 25, | ||
"cdnUrl": "https://perf.gamepiper.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 9, | ||
@@ -215,6 +223,2 @@ "cdnUrl": "https://1933886249.rsc.cdn77.org/500b-bench.jpg", | ||
}, { | ||
"id": 25, | ||
"cdnUrl": "https://perf.gamepiper.com/500b-bench.jpg", | ||
"p": "0" | ||
}, { | ||
"id": 20, | ||
@@ -224,8 +228,8 @@ "cdnUrl": "https://cdnperf.cachefly.net/500b-bench.jpg", | ||
}, { | ||
"id": 17, | ||
"cdnUrl": "https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg", | ||
"id": 13, | ||
"cdnUrl": "https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg", | ||
"p": "1" | ||
}, { | ||
"id": 8, | ||
"cdnUrl": "https://perfops.gcdn.co/500b-bench.jpg", | ||
"id": 24, | ||
"cdnUrl": "https://img-cdnperf.mncdn.com/500b-bench.jpg", | ||
"p": "1" | ||
@@ -243,2 +247,4 @@ }] | ||
return fetchResource(resource).then(function (data) { | ||
globalResults.push(data); | ||
if (!data.up) { | ||
@@ -274,3 +280,8 @@ down++; | ||
}); | ||
}).then(logInfo, logError); | ||
}).then(logInfo, logError).then(function () { | ||
done = true; | ||
resolvers.forEach(function (resolve) { | ||
return resolve(globalResults); | ||
}); | ||
}); | ||
}, 3000); | ||
@@ -311,2 +322,13 @@ } | ||
}); | ||
window.perfopsRumJs = { | ||
getResults: function getResults() { | ||
return new Promise(function (resolve) { | ||
if (done) { | ||
return resolve(globalResults); | ||
} | ||
resolvers.push(resolve); | ||
}); | ||
} | ||
}; | ||
})(window.Promise); |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(a){var n,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},e=t.logInfo,u=t.logError;function o(r,n){var t=1<arguments.length&&void 0!==n?n:{},e=t.cb,c=void 0===e?function(){}:e,o=t.data,p=t.method,d=void 0===p?"GET":p,i=t.timeout,s=void 0===i?3e3:i;return new a(function(n,t){var e=new XMLHttpRequest;e.onload=function(){if(200<=e.status&&e.status<300)return n(e);e.onerror()},e.onerror=e.ontimeout=function(){u(e),t(new Error("Status ".concat(e.status,". Response: ").concat(e.statusText)))},e.open(d,r),e.timeout=s,c(e),e.send(o)})}function r(){setTimeout(function(){o("https://api.perfops.net/rum-cdn.php").then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return n}).catch(function(){return{data:[{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"},{id:16,cdnUrl:"https://19405s.ha.azioncdn.net/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:15,cdnUrl:"https://perfstack.qtlglb.com/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:25,cdnUrl:"https://perf.gamepiper.com/500b-bench.jpg",p:"0"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"}]}}).then(function(n){var t=[],e={ua:navigator.userAgent},r=0,c=0;return function(n,r){return n.reduce(function(n,e){return n.then(function(t){return r(e).then(function(n){return t.push(n),t})})},a.resolve([]))}(n.data,function(n){return function(e){var r="".concat(e.cdnUrl,"?t=").concat(Date.now());return o(r).then(function(n){var t=performance.getEntriesByName(r)[0];return{id:e.id,up:1,time:Number((t.duration-(t.domainLookupEnd-t.domainLookupStart)-(t.connectEnd-t.connectStart)).toFixed(2)),headers:n.getAllResponseHeaders()}}).catch(function(){return{id:e.id,up:0}})}(n).then(function(n){if(n.up?2e3<n.time&&r++:c++,!(1<c||n.up&&(n.time<3||3e3<n.time)))return 2<=t.push(n)?(c=0,r<2?(r=0,p(e,t.splice(0,t.length))):(r=0,t.splice(0,t.length))):void 0})}).then(function(){if(c<=1&&t.length)return p(e,t)})}).then(e,u)},3e3)}function p(n,t){return o("https://devnull.perfops.net/rum/v1",{data:JSON.stringify({metadata:n,data:t}),method:"POST"}).catch(u)}n=function(){if(void 0!==window.performance)return"function"==typeof a?r():void function(n,t){var e,r=document.createElement("script");r.onreadystatechange=r.onload=function(){e||t(),e=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){a=window.ES6Promise,r()})},"complete"===document.readyState?n():window.addEventListener("load",n)}(window.Promise); | ||
"use strict";!function(u){var n,t=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},e=t.logInfo,a=t.logError,o=[],r=[],c=!1;function p(r,n){var t=1<arguments.length&&void 0!==n?n:{},e=t.cb,c=void 0===e?function(){}:e,o=t.data,p=t.method,i=void 0===p?"GET":p,d=t.timeout,s=void 0===d?3e3:d;return new u(function(n,t){var e=new XMLHttpRequest;e.onload=function(){if(200<=e.status&&e.status<300)return n(e);e.onerror()},e.onerror=e.ontimeout=function(){a(e),t(new Error("Status ".concat(e.status,". Response: ").concat(e.statusText)))},e.open(i,r),e.timeout=s,c(e),e.send(o)})}function i(){setTimeout(function(){p("https://api.perfops.net/rum-cdn.php").then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data||!n.data.length)throw new Error("Empty response.data");return n}).catch(function(){return{data:[{id:15,cdnUrl:"https://perfstack.qtlglb.com/500b-bench.jpg",p:"1"},{id:2,cdnUrl:"https://ovhcdn.perfstack.net/500b-bench.jpg",p:"1"},{id:11,cdnUrl:"https://perfops.b-cdn.net/500b-bench.jpg",p:"1"},{id:17,cdnUrl:"https://edgecast.perfstack.net/8086B5F/bench/500b-bench.jpg",p:"1"},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:"1"},{id:4,cdnUrl:"https://fastly.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:5,cdnUrl:"https://d2axgrpnciinw7.cloudfront.net/500b-bench.jpg",p:"1"},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:"1"},{id:16,cdnUrl:"https://19405s.ha.azioncdn.net/500b-bench.jpg",p:"1"},{id:22,cdnUrl:"https://09d3da8545e855ce.cdn.gocache.net/500b-bench.jpg",p:"1"},{id:6,cdnUrl:"https://perfops-ade2.kxcdn.com/500b-bench.jpg",p:"1"},{id:7,cdnUrl:"https://googlecdn.perfstack.net/500b-bench.jpg",p:"1"},{id:1,cdnUrl:"https://kgmni17536myjst.belugacdn.link/500b-bench.jpg",p:"1"},{id:8,cdnUrl:"https://perfops.gcdn.co/500b-bench.jpg",p:"1"},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:"1"},{id:10,cdnUrl:"https://akamai.perfstack.net/500b-bench.jpg",p:"1"},{id:3,cdnUrl:"https://perfops.perfstack.cf-china.info/500b-bench.jpg",p:"1"},{id:25,cdnUrl:"https://perf.gamepiper.com/500b-bench.jpg",p:"0"},{id:9,cdnUrl:"https://1933886249.rsc.cdn77.org/500b-bench.jpg",p:"1"},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:"1"},{id:13,cdnUrl:"https://m9d7v5r2.map2.ssl.hwcdn.net/500b-bench.jpg",p:"1"},{id:24,cdnUrl:"https://img-cdnperf.mncdn.com/500b-bench.jpg",p:"1"}]}}).then(function(n){var t=[],e={ua:navigator.userAgent},r=0,c=0;return function(n,r){return n.reduce(function(n,e){return n.then(function(t){return r(e).then(function(n){return t.push(n),t})})},u.resolve([]))}(n.data,function(n){return function(e){var r="".concat(e.cdnUrl,"?t=").concat(Date.now());return p(r).then(function(n){var t=performance.getEntriesByName(r)[0];return{id:e.id,up:1,time:Number((t.duration-(t.domainLookupEnd-t.domainLookupStart)-(t.connectEnd-t.connectStart)).toFixed(2)),headers:n.getAllResponseHeaders()}}).catch(function(){return{id:e.id,up:0}})}(n).then(function(n){if(o.push(n),n.up?2e3<n.time&&r++:c++,!(1<c||n.up&&(n.time<3||3e3<n.time)))return 2<=t.push(n)?(c=0,r<2?(r=0,d(e,t.splice(0,t.length))):(r=0,t.splice(0,t.length))):void 0})}).then(function(){if(c<=1&&t.length)return d(e,t)})}).then(e,a).then(function(){c=!0,r.forEach(function(n){return n(o)})})},3e3)}function d(n,t){return p("https://devnull.perfops.net/rum/v1",{data:JSON.stringify({metadata:n,data:t}),method:"POST"}).catch(a)}n=function(){if(void 0!==window.performance)return"function"==typeof u?i():void function(n,t){var e,r=document.createElement("script");r.onreadystatechange=r.onload=function(){e||t(),e=!0},r.setAttribute("src",n),document.body.appendChild(r)}("https://cdn.jsdelivr.net/npm/es6-promise@4.2.4/dist/es6-promise.min.js",function(){u=window.ES6Promise,i()})},"complete"===document.readyState?n():window.addEventListener("load",n),window.perfopsRumJs={getResults:function(){return new u(function(n){if(c)return n(o);r.push(n)})}}}(window.Promise); |
{ | ||
"name": "perfops-rom", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"jsdelivr": "./dist/rom3.min.js", | ||
@@ -5,0 +5,0 @@ "description": "RUM code for https://perfops.net/", |
27466
572