Closed thomaspaulin closed 3 years ago
I ran into the same issue. You don't call a .on
method, but pass a second argument to the constructor to set these callbacks:
const handlers = {
error: (error) => {},
robots: (robots, customData) => {},
// ...
}
const siteChecker = new SiteChecker(options, handlers)
Thanks @matthamil that work around...works! It doesn't fix the wrong documentation though.
Thanks @matthamil that work around...works! It doesn't fix the wrong documentation though.
Not if you use the published npm readme instead of the git trunk.
Describe the bug
on(...)
is not a function on theSiteChecker
object.To Reproduce
npm install broken-link-checker
SiteChecker
from the readme intoindex.js
.const siteChecker = new SiteChecker({}) .on('error', (error) => {}) .on('robots', (robots, customData) => {}) .on('html', (tree, robots, response, pageURL, customData) => {}) .on('queue', () => {}) .on('junk', (result, customData) => {}) .on('link', (result, customData) => {}) .on('page', (error, pageURL, customData) => {}) .on('site', (error, siteURL, customData) => {}) .on('end', () => {});
siteChecker.enqueue("https://www.google.com", undefined);