Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lightkeeper

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightkeeper - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

.nyc_output/070b3d685ed6c23a62c7808d61edfae9.json

15

dist/pharos.js

@@ -212,3 +212,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

return setTimeout(function () {
return _this.add(performance()) && resolve();
_this.add(performance());
resolve();
_this[PERF] = Promise.resolve();
});

@@ -291,2 +294,12 @@ });

}, {
key: 'clear',
value: function clear() {
var data = {};
for (var k in this[INFO]) {
data[k] = this[INFO][k];
this.delete(k);
}
return data;
}
}, {
key: 'search',

@@ -293,0 +306,0 @@ value: function search(key) {

2

dist/pharos.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.pharos=e():t.pharos=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";(function(t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.isNumber=function(t){return!isNaN(t)&&"number"==typeof t},e.isEmpty=function(t){return"object"===(void 0===t?"undefined":n(t))?"{}"===JSON.stringify(t):!t},e.build_query=function(t){var e=[];for(var o in t){var r=t[o];"object"===(void 0===r?"undefined":n(r))&&(r=JSON.stringify(r)),e.push(encodeURIComponent(o)+"="+encodeURIComponent(r))}return e.join("&")},e.getPerformance=function(){var e=t.performance;return e||console.log("Browser doesn't support Performance API"),e},e.sendLog=function(e){e&&(t.sadLog=new Image,t.sadLog.onload=t.sadLog.onerror=function(){delete t.sadLog},t.sadLog.src=e)}}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var o=n(3),r=new o;e.addEventListener("load",function(){var t=document.querySelector("script[data-siteid][data-host]");r.site_id=t.getAttribute("data-siteid"),r.host=t.getAttribute("data-host")}),t.exports=r}).call(e,n(0))},function(t,e,n){"use strict";(function(e){function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),a=n(1),u=n(4),c="info",s="addPerfData",d={};t.exports=function(){function t(e,n){r(this,t),this.site_id=e,this.host=n,this[c]={},this[s]=this.addPerf()}return i(t,[{key:"addPerf",value:function(){var t=this;return new Promise(function(n){return e.addEventListener("load",function(){return setTimeout(function(){return t.add(u())&&n()})})})}},{key:"monitor",value:function(t){var e=this;return this[s].then(function(){return e.send(t)})}},{key:"send",value:function(t){var n=this.host;/^(http|\/\/)/i.test(n)||(n=location.protocol+"//"+n);var o=n+"/api/disp?",r={site_id:this.site_id,info:a.isEmpty(t)?this[c]:t,screen:e.screen.width+"x"+e.screen.height};a.sendLog(o+a.build_query(r))}},{key:"time",value:function(t){d[t]=Date.now()}},{key:"timeEnd",value:function(t){var e=Date.now();d[t]||(d[t]=e);var n=e-d[t];this.add(t,n),console.log(t+": "+n+"ms"),delete d[t]}},{key:"add",value:function(t,e){var n=t;a.isNumber(e)&&(n=o({},t,e));for(var r in n)a.isNumber(n[r])&&(this[c][r]=n[r]);return!0}},{key:"delete",value:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var o=0;o<e.length;o++)delete this[c][e[o]];return!0}},{key:"search",value:function(t){return this[c][t]}}]),t}()}).call(e,n(0))},function(t,e,n){"use strict";var o=n(1);t.exports=function(){var t=o.getPerformance();if(!t)return{};var e=t.timing,n={};return n.loadPage=e.loadEventEnd-e.navigationStart,n.domReady=e.domComplete-e.responseEnd,n.redirect=e.redirectEnd-e.redirectStart,n.lookupDomain=e.domainLookupEnd-e.domainLookupStart,n.ttfb=e.responseStart-e.navigationStart,n.request=e.responseEnd-e.requestStart,n.loadEvent=e.loadEventEnd-e.loadEventStart,n.appcache=e.domainLookupStart-e.fetchStart,n.unloadEvent=e.unloadEventEnd-e.unloadEventStart,n.connect=e.connectEnd-e.connectStart,n}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.pharos=e():t.pharos=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";(function(t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.isNumber=function(t){return!isNaN(t)&&"number"==typeof t},e.isEmpty=function(t){return"object"===(void 0===t?"undefined":n(t))?"{}"===JSON.stringify(t):!t},e.build_query=function(t){var e=[];for(var o in t){var r=t[o];"object"===(void 0===r?"undefined":n(r))&&(r=JSON.stringify(r)),e.push(encodeURIComponent(o)+"="+encodeURIComponent(r))}return e.join("&")},e.getPerformance=function(){var e=t.performance;return e||console.log("Browser doesn't support Performance API"),e},e.sendLog=function(e){e&&(t.sadLog=new Image,t.sadLog.onload=t.sadLog.onerror=function(){delete t.sadLog},t.sadLog.src=e)}}).call(e,n(0))},function(t,e,n){"use strict";(function(e){var o=n(3),r=new o;e.addEventListener("load",function(){var t=document.querySelector("script[data-siteid][data-host]");r.site_id=t.getAttribute("data-siteid"),r.host=t.getAttribute("data-host")}),t.exports=r}).call(e,n(0))},function(t,e,n){"use strict";(function(e){function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),a=n(1),u=n(4),c="info",s="addPerfData",d={};t.exports=function(){function t(e,n){r(this,t),this.site_id=e,this.host=n,this[c]={},this[s]=this.addPerf()}return i(t,[{key:"addPerf",value:function(){var t=this;return new Promise(function(n){return e.addEventListener("load",function(){return setTimeout(function(){t.add(u()),n(),t[s]=Promise.resolve()})})})}},{key:"monitor",value:function(t){var e=this;return this[s].then(function(){return e.send(t)})}},{key:"send",value:function(t){var n=this.host;/^(http|\/\/)/i.test(n)||(n=location.protocol+"//"+n);var o=n+"/api/disp?",r={site_id:this.site_id,info:a.isEmpty(t)?this[c]:t,screen:e.screen.width+"x"+e.screen.height};a.sendLog(o+a.build_query(r))}},{key:"time",value:function(t){d[t]=Date.now()}},{key:"timeEnd",value:function(t){var e=Date.now();d[t]||(d[t]=e);var n=e-d[t];this.add(t,n),console.log(t+": "+n+"ms"),delete d[t]}},{key:"add",value:function(t,e){var n=t;a.isNumber(e)&&(n=o({},t,e));for(var r in n)a.isNumber(n[r])&&(this[c][r]=n[r]);return!0}},{key:"delete",value:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var o=0;o<e.length;o++)delete this[c][e[o]];return!0}},{key:"clear",value:function(){var t={};for(var e in this[c])t[e]=this[c][e],this.delete(e);return t}},{key:"search",value:function(t){return this[c][t]}}]),t}()}).call(e,n(0))},function(t,e,n){"use strict";var o=n(1);t.exports=function(){var t=o.getPerformance();if(!t)return{};var e=t.timing,n={};return n.loadPage=e.loadEventEnd-e.navigationStart,n.domReady=e.domComplete-e.responseEnd,n.redirect=e.redirectEnd-e.redirectStart,n.lookupDomain=e.domainLookupEnd-e.domainLookupStart,n.ttfb=e.responseStart-e.navigationStart,n.request=e.responseEnd-e.requestStart,n.loadEvent=e.loadEventEnd-e.loadEventStart,n.appcache=e.domainLookupStart-e.fetchStart,n.unloadEvent=e.unloadEventEnd-e.unloadEventStart,n.connect=e.connectEnd-e.connectStart,n}}])});

@@ -34,3 +34,6 @@ 'use strict';

return setTimeout(function () {
return _this.add(performance()) && resolve();
_this.add(performance());
resolve();
_this[PERF] = Promise.resolve();
});

@@ -113,2 +116,12 @@ });

}, {
key: 'clear',
value: function clear() {
var data = {};
for (var k in this[INFO]) {
data[k] = this[INFO][k];
this.delete(k);
}
return data;
}
}, {
key: 'search',

@@ -115,0 +128,0 @@ value: function search(key) {

{
"name": "lightkeeper",
"version": "1.1.2",
"version": "1.1.3",
"description": "Pharos data send script for Web.",

@@ -5,0 +5,0 @@ "main": "lib/pharos.js",

@@ -75,2 +75,13 @@ # lightkeeper

```
### pharos.clear()
Remote all keys from the performance data. And return old data if clear successfully.
```js
const old = pharos.clear();
console.log(old);
//{loadPage: 0, ttfb: 0, lookupDomain: 0}
```
### pharos.search(key)

@@ -77,0 +88,0 @@

@@ -108,2 +108,16 @@ const {test} = require('ava');

test('pharos clear', async t => {
t.plan(2);
global.addEventListener = new Function();
const pharos = new Pharos();
pharos.add({
aaa: 1,
bbb: 2
});
pharos.clear();
t.deepEqual(pharos.search('aaa'), undefined);
t.deepEqual(pharos.search('bbb'), undefined);
});
test('pharos search', async t => {

@@ -110,0 +124,0 @@ t.plan(2);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc