mock-xmlhttprequest
Version:
XMLHttpRequest mock for testing
29 lines (24 loc) • 555 B
JavaScript
/**
* mock-xmlhttprequest v8.4.1
* (c) 2025 Bertrand Guay-Paquet
* @license MIT
*/
;
const XhrEvent = require('./XhrEvent.cjs');
/**
* XMLHttpRequest ProgressEvent
*/
class XhrProgressEvent extends XhrEvent {
/**
* @param type Event type
* @param loaded Loaded bytes
* @param total Total bytes
*/
constructor(type, loaded = 0, total = 0) {
super(type);
this.loaded = loaded;
this.total = total;
this.lengthComputable = total > 0;
}
}
module.exports = XhrProgressEvent;