Could not find variable: Promise on iOS 7

Safari iOS 7 has reported an error Can't find variable: Promise :

 new Promise(function(resolve, reject) { . . . ) { new Promise(function(resolve, reject) { . . . 

White has other browsers do not have this problem, I found the same question , where Robert made the decision to add new Ember.RSVP.Promise instead of new Promise .

My problem is that I do not use jQuery and that all browsers return an error that Ember is not defined, and I found that the addition of Ember.min.js solves the problem, but adds an extra 129.96 KB to my page, which is not suitable for my project.

I just want to fix the problem for iOS7, and I appreciate if someone knows, he tells us.

0
source share
2 answers

You need to enable polyfill for browsers that do not support the original promises. Here's an easy, easy to use:

https://github.com/taylorhakes/promise-polyfill

+3
source

Your browser does not support just promises, so you should give it to yourself. It is not very difficult to implement promises in javascript, you can use a code or already made babel.

If you want to implement promises, you can use this https://gist.github.com/unscriptable/814052

+1
source

All Articles