« All deprecation guides
Deprecation Guide for Ember.setOwner
until: 7.0.0
id: deprecate-import-set-owner-from-ember
Previously, setOwner
could be accessed via the Ember
import:
import Ember from 'ember';
Ember.setOwner
If needed, setOwner
can be imported:
import { setOwner } from '@ember/owner';
If you're working in a library and need to support earlier than ember-source@4.11, you may use @embroider/macros
to selectively import from the old location
import {
macroCondition,
dependencySatisfies,
importSync,
} from '@embroider/macros';
let setOwner;
if (macroCondition(dependencySatisfies('ember-source', '>= 4.11'))) {
setOwner = importSync('@ember/owner').setOwner;
} else {
setOwner = importSync('@ember/application').setOwner;
}