From 2f91e2a984fe6659c691a3349740db1bb3312b32 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Sun, 31 Mar 2019 14:41:15 -0400 Subject: [PATCH] Add async callback option to a11ym runner --- lib/a11ym.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/a11ym.js b/lib/a11ym.js index f5e51df..38a2311 100644 --- a/lib/a11ym.js +++ b/lib/a11ym.js @@ -59,7 +59,8 @@ var defaultOptions = { httpAuthPassword: undefined, httpTlsDisable : undefined, verbose : true, - ignoreRobotsTxt : false + ignoreRobotsTxt : false, + processCallback: undefined }; // Set the logger. @@ -204,6 +205,12 @@ module.exports = { tester = Tester(options); maximumUrls = +options.maximumUrls; + if (typeof (options.processCallback) === 'function') { + process.on('exit', function(code) { + options.processCallback(code); + }); + } + testQueue = async.queue( function (url, onTaskComplete) { if (--maximumUrls < 0) {