-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(config): remove all usage of ember-get-config
- Loading branch information
Showing
22 changed files
with
149 additions
and
126 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { getOwner } from '@ember/application'; | ||
import { cached } from 'tracked-toolbox'; | ||
|
||
/** | ||
* Function to get the currently configured rootURL from the containers. | ||
* | ||
* @function getRootURL | ||
* @private | ||
* @param {*} target Instance of an ember class that has an owner | ||
* @returns {String} The currently configured rootURL | ||
*/ | ||
export function getRootURL(target) { | ||
return getOwner(target).resolveRegistration('config:environment').rootURL; | ||
} | ||
|
||
/** | ||
* Function to get the current configuration of `ember-cli-addon-docs` from the | ||
* container. | ||
* | ||
* @function getAddonDocsConfig | ||
* @private | ||
* @param {*} target Instance of an ember class that has an owner | ||
* @returns {Object} The `ember-cli-addon-docs` configuration object | ||
*/ | ||
export function getAddonDocsConfig(target) { | ||
return getOwner(target).resolveRegistration('config:environment')[ | ||
'ember-cli-addon-docs' | ||
]; | ||
} | ||
|
||
/** | ||
* Decorator to use the `ember-cli-addon-docs` configuration object on a class. | ||
* | ||
* Usage: | ||
* | ||
* ```js | ||
* class MyComponent extends Component { | ||
* @addonDocsConfig config; | ||
* | ||
* get projectName() { | ||
* // will return the value of `projectName` configured in the | ||
* // `ember-cli-addon-docs` section of the host configuration | ||
* return this.config.projectName: | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* @function addonDocsConfig | ||
* @private | ||
*/ | ||
export function addonDocsConfig(target, property, descriptor) { | ||
return cached(target, property, { | ||
get() { | ||
return getAddonDocsConfig(this); | ||
}, | ||
}); | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.