1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | let instance = null;
|
4 | class CallLog {
|
5 | static get instance() {
|
6 | if (instance)
|
7 | return instance;
|
8 | instance = new CallLog();
|
9 | return instance;
|
10 | }
|
11 | static reset() {
|
12 | instance = null;
|
13 | }
|
14 | constructor() {
|
15 | this.calls = new Map();
|
16 | this.callHistory = [];
|
17 | }
|
18 | log(double, call) {
|
19 | this.callHistory.push({ double, call });
|
20 | if (this.calls.has(double)) {
|
21 | this.calls.get(double).push(call);
|
22 | }
|
23 | else {
|
24 | this.calls.set(double, [call]);
|
25 | }
|
26 | }
|
27 | for(double) {
|
28 | return this.calls.get(double);
|
29 | }
|
30 | pop() {
|
31 | const lastCall = this.callHistory.pop();
|
32 | if (lastCall && this.calls.has(lastCall.double)) {
|
33 | this.calls.get(lastCall.double).pop();
|
34 | }
|
35 | return lastCall;
|
36 | }
|
37 | }
|
38 | exports.default = CallLog;
|