Comparing version 0.1.0 to 0.2.0
@@ -8,2 +8,3 @@ const Promise = require('bluebird'); | ||
browserName: 'chrome', | ||
pageLoadStrategy: 'none', | ||
loggingPrefs: { | ||
@@ -14,3 +15,2 @@ performance: 'ALL' | ||
perfLoggingPrefs: { | ||
enableNetwork: true, | ||
traceCategories: 'devtools.timeline' | ||
@@ -17,0 +17,0 @@ } |
@@ -9,2 +9,3 @@ const Promise = require('bluebird'); | ||
opts.count = opts.count || 5; | ||
opts.sleep = opts.sleep || 0; | ||
if (!opts.url) { | ||
@@ -11,0 +12,0 @@ return Promise.reject(new Error('`url` option must be provided')); |
@@ -14,3 +14,3 @@ /** | ||
line.message = JSON.parse(line.message); | ||
line.timestamp = line.message.message.params.timestamp || line.message.message.params.ts / 1e6; | ||
line.timestamp = line.message.message.params.timestamp || (line.message.message.params.ts / 1e6); | ||
} catch (e) {} | ||
@@ -20,5 +20,15 @@ return line; | ||
lines = lines.filter((l) => !isNaN(l.timestamp)); | ||
lines = lines.sort((a, b) => a.timestamp < b.timestamp ? -1 : 1); | ||
return lines.slice(getStart(lines, host)); | ||
lines = lines.slice(getStart(lines, host)); | ||
const start = lines[0].timestamp; | ||
lines.forEach(l => { | ||
l.timestamp -= start; | ||
}); | ||
return lines; | ||
} | ||
@@ -25,0 +35,0 @@ |
@@ -0,1 +1,2 @@ | ||
const wd = require('wd'); | ||
const Promise = require('bluebird'); | ||
@@ -10,2 +11,17 @@ const browser = require('./browser'); | ||
.get(opts.url) | ||
.then(() => { | ||
return Promise.resolve() | ||
.then(() => { | ||
if (typeof opts.inject === 'function') { | ||
return opts.inject(session); | ||
} | ||
}) | ||
.then(() => { | ||
return session.waitFor(wd.asserters.jsCondition(`document.readyState==='complete'`), 30000); | ||
}) | ||
.then(() => { | ||
return session; | ||
}); | ||
}) | ||
.sleep(opts.sleep) | ||
.log('performance') | ||
@@ -12,0 +28,0 @@ .then((logs) => { |
@@ -8,3 +8,2 @@ const wd = require('wd'); | ||
opts.browser = wd.remote('http://localhost:9515', 'promiseChain'); | ||
return Promise.map(times(opts.count), page(opts), { concurrency: 1 }); | ||
@@ -11,0 +10,0 @@ } |
{ | ||
"name": "timeliner", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Network Timeline Analyser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9305
17
177