8000 fix(ember): use `_backburner` if it exists (#4603) · ptim/sentry-javascript@9c0434b · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c0434b

Browse files
authored
fix(ember): use _backburner if it exists (getsentry#4603)
1 parent 7f7ed91 commit 9c0434b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import ApplicationInstance from '@ember/application/instance';
22
import Ember from 'ember';
33
import { run, _backburner, scheduleOnce } from '@ember/runloop';
44
import * as Sentry from '@sentry/browser';
5+
import { ExtendedBackburner } from "@sentry/ember/runloop";
56
import { Span, Transaction, Integration } from '@sentry/types';
67
import { EmberRunQueues } from '@ember/runloop/-private/types';
78
import { getActiveTransaction } from '..';
@@ -28,11 +29,19 @@ export function initialize(appInstance: ApplicationInstance): void {
2829
}
2930
}
3031

31-
function getBackburner() {
32+
function getBackburner(): Pick<ExtendedBackburner, "on" | "off"> {
33+
if (_backburner) {
34+
return _backburner;
35+
}
36+
3237
if (run.backburner) {
3338
return run.backburner;
3439
}
35-
return _backburner;
40+
41+
return {
42+
on() {},
43+
off() {}
44+
}
3645
}
3746

3847
function getTransitionInformation(transition: any, router: any) {

0 commit comments

Comments
 (0)
0