admin管理员组文章数量:1390609
I have an ionic app that uses the set data structure in one of it's method. When I try to run the app on my android device(Android 5.0.2,API 21), I run into this error
ReferenceError: Set is not defined
at Object.myMethod
Here is a code snippet showing the line responsible for the error
myMethod: function(userid) {
var user = [];
var service = this;
var userIDs = new Set();
var promises = [];
...}
I am not a javascript guru but it seems to me that it might be a problem with the android web view on my device not having a built in implementation of the Set data structure. To further confuse matters, I tested this same app on another device(HTC One M8(Android 5.0.1,API 21)) and it worked fine with no errors shown. Does anybody know how to fix this?
I have an ionic app that uses the set data structure in one of it's method. When I try to run the app on my android device(Android 5.0.2,API 21), I run into this error
ReferenceError: Set is not defined
at Object.myMethod
Here is a code snippet showing the line responsible for the error
myMethod: function(userid) {
var user = [];
var service = this;
var userIDs = new Set();
var promises = [];
...}
I am not a javascript guru but it seems to me that it might be a problem with the android web view on my device not having a built in implementation of the Set data structure. To further confuse matters, I tested this same app on another device(HTC One M8(Android 5.0.1,API 21)) and it worked fine with no errors shown. Does anybody know how to fix this?
Share Improve this question asked Aug 9, 2016 at 15:50 OyebisiOyebisi 7542 gold badges11 silver badges25 bronze badges2 Answers
Reset to default 3You should try a polyfill for those devices that does not support Set
:
https://github./medikoo/es6-set
It's not the most optimal option, but you could use dictionary with boolean values...
var userIDs = {};
userID["anyUserId"] = true;
版权声明:本文标题:javascript - ReferenceError: Set is not defined. Error utilizing Set data structure in Ionic app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744737107a2622397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论