Skip to content

Commit

Permalink
docs: update example on how to run sitespeed.io
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Oct 23, 2023
1 parent 371c32a commit 37e3c19
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions docs/documentation/sitespeed.io/developers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,27 @@ The big picture looks something like this:
Here's an example on how to use sitespeed.io directly from NodeJS. This will generate the result to disk but you will not get it as a JSON object (only the budget result). We maybe change that in the future. If you need the JSON you can either read it from disk or use the Browsertime plugin directly.

~~~javascript
'use strict';

const sitespeed = require('sitespeed.io');
import { run as runSitespeedio } from 'sitespeed.io';
const urls = ['https://www.sitespeed.io/'];

async function run() {
try {
const result = await sitespeed.run({
const result = await runSitespeedio({
urls,
browsertime: {
iterations: 1,
connectivity: {
profile: 'native',
downstreamKbps: undefined,
upstreamKbps: undefined,
latency: undefined,
engine: 'external'
},
browser: 'chrome'
}
});
console.log(result);
} catch (e) {
console.error(e);
} catch (error) {
console.error(error);
}
}

run();
await run();

~~~

### Use Browsertime from NodeJS
Expand Down

0 comments on commit 37e3c19

Please sign in to comment.