Closed kamalakkanni closed 6 years ago
Could you add below code globally ?
if (!Array.prototype.findIndex) {
Object.defineProperty(Array.prototype, 'findIndex', {
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return k.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
// e. Increase k by 1.
k++;
}
// 7. Return -1.
return -1;
},
configurable: true,
writable: true
});
}
if you are getting confused about how to add it - just add it in index.html file under script section. Let me know what's the result.
Thanks,But I got same error
could you run this in console of ie where you are getting this error.
var array1 = [5, 12, 8, 130, 44];
function findFirstLargeNumber(element) {
return element > 13;
}
console.log(array1.findIndex(findFirstLargeNumber));
let me know whats you are getting.
I am getting below output undefined 3
it means that findIndex is working. In this case - you are including the findIndex script after the jsstore. Please make sure that you are including the findIndex script before jsstore initialize.
You mean
`
<script>
if (!Array.prototype.findIndex) {
Object.defineProperty(Array.prototype, 'findIndex', {
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return k.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
// e. Increase k by 1.
k++;
}
// 7. Return -1.
return -1;
},
configurable: true,
writable: true
});
}
`yes
but not working.same error
could you confirm if its the same error. I mean is it saying - findIndex or just find ? Please read the whole error message. Better paste the screenshot here.
TypeError: Object doesn't support property or method 'findIndex'
ok. add this before the findIndex.
// https://tc39.github.io/ecma262/#sec-array.prototype.find
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return kValue.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return kValue;
}
// e. Increase k by 1.
k++;
}
// 7. Return undefined.
return undefined;
},
configurable: true,
writable: true
});
}
let me know
Ok, I would create a demo which will support the ie. This will help you to see what's going wrong. I will upload the demo by tomorrow.
Thanks
not yet solved.ok thanks
Hi,any update on this
Hi
Yes I am working on this. I am creating separate build for ie support. This may take some time, not sure how much.
On Tue 18 Sep, 2018, 7:43 PM kamalakkanni, notifications@github.com wrote:
Hi,any update on this
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ujjwalguptaofficial/JsStore/issues/75#issuecomment-422409187, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbo9x9pFBQwu_PPT9p1AWz9xma0gMtCks5ucP-MgaJpZM4WlV-4 .
Hi,this is just remainder.If u finished means,pls let me know
yep i m working on it.
Hi @kamalakkanni - I have created the build for ie. There is separate file for ie support which contains inbuilt polyfill. Here is the example - https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/webpack%20with%20ie%20support
So basically you need to use - jsstore.worker.ie.js instead of jsstore.worker.js . You can use minified version or dev version, its upto you.
Hope this will help you.
@kamalakkanni - just found, its not stable. Please ignore the above suggestion. I need to work more on this.
@kamalakkanni - issue is resolved. Please install latest verson - 2.4.3. For supporting in ie - you need to use the file : jsstore.worker.ie.min.js . its a special build for working in ie through webworker.
Here is the example for more help - https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/webpack%20with%20ie%20support
Please let me know if everything is working for you.
Thank you so much.its working fine now
Hi,
Object doesn't support property or method 'findIndex' in ie while using jsstore. [https://github.com/ujjwalguptaofficial/JsStore/issues/45] This issue is not yet fixed.pls help me to fix it.
Thanks and Regards Kamalakkanni.V