Skip to content

Commit

Permalink
Merge pull request #17 from pzuraq/adds-error-for-ie-11
Browse files Browse the repository at this point in the history
[FEAT] Adds error when attempting to use in IE11
  • Loading branch information
pzuraq authored Mar 17, 2020
2 parents 0b65f51 + 4d1d6f9 commit c880077
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
tracked-built-ins
==============================================================================

> **IMPORTANT: This addon does _NOT_ support IE 11 or older browsers. If you
> need to support them, consider using [tracked-maps and sets](https://github.com/pzuraq/tracked-maps-and-sets)
> instead.**
This addon provides tracked versions of JavaScript's built-ins:

```js
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use strict';

module.exports = {
name: require('./package').name
name: require('./package').name,

included() {
this._super.included.apply(this, arguments);

if (this.project.targets.browsers.includes('ie 11')) {
throw new Error('`tracked-built-ins` uses Proxy, which is not supported in IE 11 or other older browsers. You have included IE 11 in your targets, which is not supported. Consider using `tracked-maps-and-sets`, which does support IE 11.');
}
}
};
14 changes: 4 additions & 10 deletions tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
'use strict';

const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions',
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Safari versions',
'last 2 Edge versions',
];

const isCI = !!process.env.CI;
const isProduction = process.env.EMBER_ENV === 'production';

if (isCI || isProduction) {
browsers.push('ie 11');
}

module.exports = {
browsers,
};

0 comments on commit c880077

Please sign in to comment.