From 37e3c191e497db2410ee989872efca74a94e4441 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Mon, 23 Oct 2023 18:07:58 +0200 Subject: [PATCH] docs: update example on how to run sitespeed.io --- .../sitespeed.io/developers/index.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/documentation/sitespeed.io/developers/index.md b/docs/documentation/sitespeed.io/developers/index.md index 67d3ad2351..318b8d1d76 100644 --- a/docs/documentation/sitespeed.io/developers/index.md +++ b/docs/documentation/sitespeed.io/developers/index.md @@ -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