Skip to content

Commit

Permalink
Merge pull request #34 from bendemboski/update-readme
Browse files Browse the repository at this point in the history
Document API for reading features at build/run-time
  • Loading branch information
rwjblue authored Oct 6, 2018
2 parents bc02039 + 533d829 commit 6d584b7
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ ember install @ember/optional-features

## Usage

### List available features
### From command-line

#### List available features

Features will only be available in versions of ember-source that included them. To list all available features run:

```bash
ember feature:list
```

### Enable/disable features
#### Enable/disable features

To enable a feature, run:

Expand All @@ -31,3 +33,20 @@ Similarly, if you want to disable a feature, you can run:
```bash
ember feature:disable some-feature
```

### At build-time (from an addon)

This addon exposes a build-time method called `isFeatureEnabled`, which can be called from an addon's `index.js`, e.g.:

```javascript
included() {
let optionalFeatues = this.addons.find(a => a.name === '@ember/optional-features');
if (optionalFeatures.isFeatureEnabled('jquery-integration') {
// ...
}
}
```
### At run-time (from an app or addon)
WIP -- there does not yet exist a public API for accessing the state of optional features at runtime. [This](https://github.com/pzuraq/ember-compatibility-helpers/issues/27) issue is tracking it.

0 comments on commit 6d584b7

Please sign in to comment.