Skip to content

Commit

Permalink
Add note for getOwner / setOwner, since they recently moved
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jun 6, 2024
1 parent eef69eb commit e1215ee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions content/ember/v5/deprecate-import-get-owner-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ If needed, `getOwner` can be imported:
```js
import { getOwner } from '@ember/owner';
```

If you're working in a library and need to support earlier than [email protected], you may use `@embroider/macros` to selectively import from the old location
```js
import {
macroCondition,
dependencySatisfies,
importSync,
} from '@embroider/macros';

let getOwner;

if (macroCondition(dependencySatisfies('ember-source', '>= 4.11'))) {
getOwner = importSync('@ember/owner').getOwner;
} else {
getOwner = importSync('@ember/application').getOwner;
}
```
17 changes: 17 additions & 0 deletions content/ember/v5/deprecate-import-set-owner-from-ember.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ If needed, `setOwner` can be imported:
```js
import { setOwner } from '@ember/owner';
```

If you're working in a library and need to support earlier than [email protected], you may use `@embroider/macros` to selectively import from the old location
```js
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;
}
```

0 comments on commit e1215ee

Please sign in to comment.