Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API examples #587

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ Constructor method that can be used to create a new `LinkChecker` instance. Thi
#### Simple example

```js
const link = require('linkinator');
import { LinkChecker } from 'linkinator';

async function simple() {
const results = await link.check({
const checker = new LinkChecker();
const results = await checker.check({
path: 'http://example.com'
});

Expand Down Expand Up @@ -277,11 +278,11 @@ simple();
In most cases you're going to want to respond to events, as running the check command can kinda take a long time.

```js
const link = require('linkinator');
import { LinkChecker } from 'linkinator';

async function complex() {
// create a new `LinkChecker` that we'll use to run the scan.
const checker = new link.LinkChecker();
const checker = new LinkChecker();

// Respond to the beginning of a new page being scanned
checker.on('pagestart', url => {
Expand Down