UNPKG

1.42 kBMarkdownView Raw
1# @ember/optional-features
2
3This addon allows you to easily enable/disable optional features in ember-source. To clarify what we mean by optional, these are features that will be opt-in/opt-out and optional for the foreseeable future, not features that will be enabled by default. It is intended for use with apps *only* not addons.
4
5## Installation
6
7```bash
8ember install @ember/optional-features
9```
10
11## Usage
12
13### From command-line
14
15#### List available features
16
17Features will only be available in versions of ember-source that included them. To list all available features run:
18
19```bash
20ember feature:list
21```
22
23#### Enable/disable features
24
25To enable a feature, run:
26
27```bash
28ember feature:enable some-feature
29```
30
31Similarly, if you want to disable a feature, you can run:
32
33```bash
34ember feature:disable some-feature
35```
36
37### At build-time (from an addon)
38
39This addon exposes a build-time method called `isFeatureEnabled`, which can be called from an addon's `index.js`, e.g.:
40
41```javascript
42included() {
43 let optionalFeatues = this.addons.find(a => a.name === '@ember/optional-features');
44 if (optionalFeatures.isFeatureEnabled('jquery-integration') {
45 // ...
46 }
47}
48```
49
50### At run-time (from an app or addon)
51
52WIP -- 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.