Reputation: 903
I have one file which contains this function:
$(function () {
window.selected = {};
const pageFilter = new PageFilter(); <-ERROR HERE
const filters = JSON.parse(pageFilter.toString());
[do other stuff]
});
And in another file I have my PageFilters
class defined as such:
class PageFilter {
constructor() {
if (typeof window.Filters === "undefined") {
window.Filters = {};
window.pendingNotifications = [];
const columnFilter = Util.getParameterByName("columnFilter");
const trimedFilter = columnFilter.substring(1, columnFilter.length - 1);
if (trimedFilter.length > 0) {
const parsedColumnFilter = JSON.parse(trimedFilter);
this.addRange(parsedColumnFilter);
}
}
}
...[more methods etc.]
}
And when I run my entire project in chrome or firefox, i don't get any errors, however when I run it in Internet Explorer, I get an error when I try to create a new PageFilter()
object.
Anyone have any insight as to why I might be getting this error only in ie and no other browsers? Any possible fixes?
I'm also having a similar issue in another area of my code where I try to call another javascript class from a cshtml file, and it also says that it is undefined but only in ie. Any insight on this would be great, thanks!
Upvotes: 1
Views: 83
Reputation:
JavaScript classes are a core part of the ES6 language feature set.
Those are not directly supported in IE, you need to transpile your code first.
Babel is the go-to transpiler for ES6.
Upvotes: 1