luhn-generator
Version:
A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm
29 lines (24 loc) • 739 B
JavaScript
import { respondable } from '../../core/utils';
function frameTestedEvaluate(node, options) {
const resolve = this.async();
const { isViolation, timeout } = Object.assign(
{ isViolation: false, timeout: 500 },
options
);
// give the frame .5s to respond to 'axe.ping', else log failed response
let timer = setTimeout(function() {
// This double timeout is important for allowing iframes to respond
// DO NOT REMOVE
timer = setTimeout(function() {
timer = null;
resolve(isViolation ? false : undefined);
}, 0);
}, timeout);
respondable(node.contentWindow, 'axe.ping', null, undefined, function() {
if (timer !== null) {
clearTimeout(timer);
resolve(true);
}
});
}
export default frameTestedEvaluate;