-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add note for getOwner / setOwner, since they recently moved
- Loading branch information
1 parent
eef69eb
commit e1215ee
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
``` |