Skip to content

Commit b22e359

Browse files
leroydevHazAT
authored andcommitted
feat: Added onLoad callback to showReportDialog (getsentry#2061)
* feat: Added onLoad callback to showReportDialog * meta: Changelog
1 parent 02966c6 commit b22e359

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- [browser] - feat: Added `onLoad` callback to `showReportDialog`
6+
37
## 5.2.0
48

59
- [opentracing] ref: Removed opentracing package

packages/browser/src/client.ts

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface ReportDialogOptions {
2828
errorGeneric?: string;
2929
errorFormEntry?: string;
3030
successMessage?: string;
31+
onLoad?(): void;
3132
}
3233

3334
/**
@@ -99,6 +100,11 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
99100
const script = document.createElement('script');
100101
script.async = true;
101102
script.src = new API(dsn).getReportDialogEndpoint(options);
103+
104+
if (options.onLoad) {
105+
script.onload = options.onLoad;
106+
}
107+
102108
(document.head || document.body).appendChild(script);
103109
}
104110
}

0 commit comments

Comments
 (0)