Skip to content

Commit

Permalink
IE 11 fix
Browse files Browse the repository at this point in the history
fetch polyfill
  • Loading branch information
igorT committed Sep 1, 2021
1 parent c0ab1b1 commit 8159e78
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 11 deletions.
14 changes: 10 additions & 4 deletions addon/base-record-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { CUSTOM_MODEL_CLASS } from 'ember-m3/-infra/features';
import { recordDataToRecordMap, recordToRecordArrayMap } from './utils/caches';
import { recordIdentifierFor } from '@ember-data/store';

const HAS_NATIVE_PROXY = typeof Proxy === 'function';

/**
* BaseRecordArray
*
Expand Down Expand Up @@ -79,10 +81,14 @@ if (CUSTOM_MODEL_CLASS) {
// public RecordArray API
static create(...args) {
let instance = super.create(...args);

let arr = [];
arr.__recordArray = instance;
return new Proxy(arr, baseRecordArrayProxyHandler);
if (HAS_NATIVE_PROXY) {
let arr = [];
arr.__recordArray = instance;
return new Proxy(arr, baseRecordArrayProxyHandler);
// IE11 support
} else {
return instance;
}
}

init() {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ember-compatibility-helpers": "^1.2.5",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.1.1",
"ember-inflector": "^4.0.2",
"ember-load-initializers": "^2.1.2",
"ember-lodash": "^4.17.5",
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/adapters/-json-api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import EmberObject from '@ember/object';
import fetch from 'fetch';

export default class Adapter extends EmberObject {
async ajax(url) {
Expand Down

0 comments on commit 8159e78

Please sign in to comment.