KangoExtensions / kango

Kango framework issue tracker
74 stars 7 forks source link

IE fails to stringify/parse arrays #154

Open ar7casper opened 8 years ago

ar7casper commented 8 years ago

After using kango.storage.getItem on an array, the array that is returned is CSV. No map, reduce, etc.

var foo = ['bar1', 'bar2']; kango.storage.setItem('foo', foo); var outcome = kango.storage.getItem('foo'); outcome.map(funciton(v){ console.log(v); });

The code breaks on the map method -

Error in script (unknown): Object doesn't support property or method "map"......

When I print out the type of "outcome", i get [object Object] instead of [object Array].

I reckon that it happens due to compatibility with older versions of IE. Microsoft announced that they drop support for IE10- - https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE-support

Any chance for a quick fix on that?

akrylysov commented 8 years ago

We are looking for a way to fix the issue, meanwhile you can use this workaround:

function arrayLikeObjectToArray(obj) {
    var result = [];
    for (var i = 0; i < obj.length; i++) {
        result.push(obj[i]);
    }
    return result;
}

var outcome = arrayLikeObjectToArray(kango.storage.getItem('foo'));
ar7casper commented 8 years ago

Hi,

Thank you for your reply. Do you have an estimate on when it's going to be ready?

Another issue I encountered - I'm using window.postMessage to communicate different things. When I'm using window.postMessage from the console, all works, when I click somewhere in the app where it invokes the postMessage, I get the following msg - "No such interface supported". (On IE). Do you know this problem? Do you know a way to workaround pass it?

Thank you very much, Alex.

Alex

On Thu, Feb 4, 2016 at 3:56 PM, Artem Krylysov notifications@github.com wrote:

We are looking for a way to fix the issue, meanwhile you can use this workaround:

function arrayLikeObjectToArray(obj) { var result = []; for (var i = 0; i < obj.length; i++) { result.push(obj[i]); } return result; } var outcome = arrayLikeObjectToArray(kango.storage.getItem('foo'));

— Reply to this email directly or view it on GitHub https://github.com/KangoExtensions/kango/issues/154#issuecomment-179850201 .

ar7casper commented 8 years ago

Hi,

Can you help us with updates regarding IE & FF?