taist 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/trace-reporter.js +15 -2
- package/package.json +1 -1
package/lib/trace-reporter.js
CHANGED
|
@@ -542,9 +542,22 @@ export function report(trace) {
|
|
|
542
542
|
* Flush the global reporter
|
|
543
543
|
*/
|
|
544
544
|
export async function flush() {
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
const reporter = globalThis[TAIST_REPORTER_KEY];
|
|
546
|
+
if (reporter) {
|
|
547
|
+
await reporter.flush();
|
|
547
548
|
}
|
|
548
549
|
}
|
|
549
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Reset the global reporter (for testing purposes).
|
|
553
|
+
* Closes the existing reporter and clears the singleton.
|
|
554
|
+
*/
|
|
555
|
+
export function resetGlobalReporter() {
|
|
556
|
+
const reporter = globalThis[TAIST_REPORTER_KEY];
|
|
557
|
+
if (reporter) {
|
|
558
|
+
reporter.close();
|
|
559
|
+
}
|
|
560
|
+
globalThis[TAIST_REPORTER_KEY] = null;
|
|
561
|
+
}
|
|
562
|
+
|
|
550
563
|
export default TraceReporter;
|