mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 21:21:03 +00:00
Update har.js
This commit is contained in:
parent
1b8fbf78bf
commit
ac2e1117a7
18
lib/har.js
18
lib/har.js
|
@ -9,11 +9,16 @@ var HARObject = function() {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
this.entryIndex = 0;
|
this.entryIndex = 0;
|
||||||
this.onEntry = null;
|
this.onEntry = null;
|
||||||
|
this.filters = [];
|
||||||
|
|
||||||
this.setEntryIndex = function(index) {
|
this.setEntryIndex = function(index) {
|
||||||
this.entryIndex = index;
|
this.entryIndex = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.addFilter = function(f) {
|
||||||
|
this.filters.push(f);
|
||||||
|
};
|
||||||
|
|
||||||
this.load = function(filename) {
|
this.load = function(filename) {
|
||||||
this.filename = filename;
|
this.filename = filename;
|
||||||
this.data = JSON.parse(FILE.readFile(this.filename, PipeIPC.CdoUTF_8));
|
this.data = JSON.parse(FILE.readFile(this.filename, PipeIPC.CdoUTF_8));
|
||||||
|
@ -26,6 +31,17 @@ var HARObject = function() {
|
||||||
while (this.entryIndex < entries.length) {
|
while (this.entryIndex < entries.length) {
|
||||||
var entry = entries[this.entryIndex];
|
var entry = entries[this.entryIndex];
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
while (i < this.filters.length && typeof this.filters[i] === "function") {
|
||||||
|
try {
|
||||||
|
if (!this.filters[i](entry))
|
||||||
|
return;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e.message);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof callback !== "function") {
|
if (typeof callback !== "function") {
|
||||||
console.log(
|
console.log(
|
||||||
'[' + entry.startedDateTime + ']',
|
'[' + entry.startedDateTime + ']',
|
||||||
|
@ -58,7 +74,7 @@ var HARObject = function() {
|
||||||
|
|
||||||
exports.HARObject = HARObject;
|
exports.HARObject = HARObject;
|
||||||
|
|
||||||
exports.VERSIONINFO = "HAR(HTTP Archive) manipulate and replay tools version 0.1.3";
|
exports.VERSIONINFO = "HAR(HTTP Archive) manipulate and replay tools version 0.1.4";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = require;
|
exports.require = require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user