找不到变数:iOS 7上的Promise [英] Can't find variable: Promise on iOS 7

查看:138
本文介绍了找不到变数:iOS 7上的Promise的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 7 Safari报告错误找不到变量:Promise

iOS 7 Safari is reporting the error Can't find variable: Promise:

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

白色其他浏览器没有这个问题,我发现这个类似的问题罗伯特给出了一个解决方案来添加新的Ember.RSVP.Promise 而不是新的Promise

White other browsers don't have this issue, I found this similar question where Robert gave a solution to add new Ember.RSVP.Promise instead of the new Promise.

我的问题是我没有使用jQuery,这使所有浏览器都返回错误, Ember 没有定义,我发现添加 Ember.min.js 解决了这个问题,但是增加了额外的$ code> 129.96 KB 到我的页面,这对我的项目来说不是很好。

My problem is that I'm not using jQuery and that makes all browsers return an error that Ember is not defined, and I found that adding Ember.min.js solves the issue, but that adds extra 129.96 KB to my page which is not good at all to my project.

我只是想解决iOS7的问题,我很感激,如果有人知道他如何告诉我们

I just want to fix the problem for iOS7, and I appreciate if somebody who knows how he tell us.

推荐答案

您需要包含一个polyfill for br不支持本机的承诺的输入。这是一个轻量级的,很容易使用:

You need to include a polyfill for browsers that don't support promises natively. Here is a light weight one that is easy to use:

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

这篇关于找不到变数:iOS 7上的Promise的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆