Skip to content

Commit

Permalink
fix(ember): use _backburner if it exists (#4603)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbernery authored Feb 25, 2022
1 parent 7f7ed91 commit 9c0434b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/ember/addon/instance-initializers/sentry-performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ApplicationInstance from '@ember/application/instance';
import Ember from 'ember';
import { run, _backburner, scheduleOnce } from '@ember/runloop';
import * as Sentry from '@sentry/browser';
import { ExtendedBackburner } from "@sentry/ember/runloop";
import { Span, Transaction, Integration } from '@sentry/types';
import { EmberRunQueues } from '@ember/runloop/-private/types';
import { getActiveTransaction } from '..';
Expand All @@ -28,11 +29,19 @@ export function initialize(appInstance: ApplicationInstance): void {
}
}

function getBackburner() {
function getBackburner(): Pick<ExtendedBackburner, "on" | "off"> {
if (_backburner) {
return _backburner;
}

if (run.backburner) {
return run.backburner;
}
return _backburner;

return {
on() {},
off() {}
}
}

function getTransitionInformation(transition: any, router: any) {
Expand Down

0 comments on commit 9c0434b

Please sign in to comment.