github
1353 of 1530 branches covered (88.43%)
Branch coverage included in aggregate %.
83 of 1570 new or added lines in 22 files covered. (5.29%)
5529 of 10833 relevant lines covered (51.04%)
28.07 hits per line
NEW
|
// eslint-disable no-case-declarations
|
× |
NEW
|
import type { PageSpyPlugin } from '@huolala-tech/page-spy-types'; |
× |
NEW
|
import XhrProxy from './proxy/xhr-proxy'; |
× |
NEW
|
import FetchProxy from './proxy/fetch-proxy'; |
× |
NEW
|
|
× |
NEW
|
export default class NetworkPlugin implements PageSpyPlugin { |
× |
NEW
|
public name = 'NetworkPlugin'; |
× |
NEW
|
|
× |
NEW
|
public xhrProxy: XhrProxy | null = null;
|
× |
NEW
|
public fetchProxy: FetchProxy | null = null;
|
× |
NEW
|
|
× |
NEW
|
public static hasInitd = false; |
× |
NEW
|
|
× |
NEW
|
public onInit() {
|
× |
NEW
|
if (NetworkPlugin.hasInitd) return; |
× |
NEW
|
NetworkPlugin.hasInitd = true;
|
× |
NEW
|
|
× |
NEW
|
this.fetchProxy = new FetchProxy(); |
× |
NEW
|
this.xhrProxy = new XhrProxy(); |
× |
NEW
|
} |
× |
NEW
|
|
× |
NEW
|
public onReset() {
|
× |
NEW
|
this.fetchProxy?.reset();
|
× |
NEW
|
this.xhrProxy?.reset();
|
× |
NEW
|
NetworkPlugin.hasInitd = false;
|
× |
NEW
|
} |
× |
NEW
|
} |
× |