Welcome Guest Search | Active Topics | Sign In | Register

JSArray removed in latest version Options
Peavy
Posted: Wednesday, July 19, 2017 6:19:53 PM
Rank: Advanced Member
Groups: Member

Joined: 6/26/2015
Posts: 98
Hello, we were just trying to update to the latest version of EO and noticed a breaking change. It looks like it no longer has the JSArray type and I can't seem to find documentation to work around this.

This is the code we were using:
Code: C#
try
            {
                var scrollInfo = (JSObject)addin.ActiveBrowser.WebView.EvalScript(javaScript);
                if (scrollInfo != null && scrollInfo.ToString() != "null" && scrollInfo["scrollers"] != null && scrollInfo["largest"] != null)
                {
                    var index = Int32.Parse(scrollInfo["largest"].ToString());
                    var elements = new List<string>();
                    foreach (var eoElement in (scrollInfo["scrollers"] as JSArray))
                    {
                        var element = eoElement as JSObject;
                        elements.Add(element["tagName"].ToString());
                    }

                    return elements;
                }

                return Enumerable.Empty<string>().ToList();
            }
            catch
            {
                throw;  //let it bubble up
            }



I tried the following code to replace JSArray, but received the error "Object reference not set to an instance of an object."
Code: C#
scrollInfo["scrollers"] as JSRealObject).ToArray()


What would be the best way to replace JSArray?
eo_support
Posted: Wednesday, July 19, 2017 6:21:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

You would replace it with object[].

Thanks!
Peavy
Posted: Wednesday, July 19, 2017 6:58:51 PM
Rank: Advanced Member
Groups: Member

Joined: 6/26/2015
Posts: 98
That was simple enough. Thank you!
eo_support
Posted: Thursday, July 20, 2017 10:14:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
You are very welcome. Sorry for the trouble and please feel free to let us know if you have any more questions.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.