private void SetResult(IJavascriptObject[] e, IJSCBridgeCache bridge, Task <object> resulttask)
        {
            _IWebView.RunAsync(() =>
            {
                if (e.Length < 2)
                {
                    return;
                }

                IJavascriptObject promise = e[1];
                if (!resulttask.IsFaulted)
                {
                    bridge.RegisterInSession(resulttask.Result, (bridgevalue) =>
                    {
                        promise.InvokeAsync("fullfill", _IWebView, bridgevalue.GetJSSessionValue());
                    });
                }
                else
                {
                    string error = (resulttask.IsCanceled) ? "Cancelled" :
                                   ((resulttask.Exception == null) ? "Faulted" : resulttask.Exception.Flatten().InnerException.Message);

                    promise.InvokeAsync("reject", _IWebView, _IWebView.Factory.CreateString(error));
                }
            });
        }
        public void SpliceCollection(IJavascriptObject array, int index, int number, IJavascriptObject[] items)
        {
            var parameters = new IJavascriptObject[items.Length + 2];

            parameters[0] = _WebView.Factory.CreateInt(index);
            parameters[1] = _WebView.Factory.CreateInt(number);
            var idx = 2;

            items.ForEach(item => parameters[idx++] = item);
            array.InvokeAsync("silentsplice", _WebView, parameters);
        }
        private async Task SetError(IJavascriptObject promise, Exception exception)
        {
            if (promise == null)
                return;

            await WebView.RunAsync(async () =>
            {
                var errormessage = exception?.Message ?? "Faulted";
                await promise.InvokeAsync("reject", WebView, WebView.Factory.CreateString(errormessage));
            });
        }
        private async Task SetResult(IJavascriptObject promise, object result)
        {
            if (promise == null)
                return;

            await _WebView.RunAsync(async () =>
            {
                var bridgevalue = await _JavascriptToCSharpConverter.RegisterInSession(result);
                await promise.InvokeAsync("fullfill", _WebView, bridgevalue.GetJSSessionValue());
            });
        }
        private async Task SetResult(IJavascriptObject promise, object result)
        {
            if (promise == null)
                return;

            await WebView.RunAsync(async () =>
            {
                var bridgevalue = await _JavascriptToCSharpConverter.RegisterInSession(result);
                await promise.InvokeAsync("fullfill", WebView, bridgevalue.GetJSSessionValue());
            });
        }
        private async Task SetError(IJavascriptObject promise, Exception exception)
        {
            if (promise == null)
                return;

            await WebView.RunAsync(async () =>
            {
                var errormessage = exception?.Message ?? "Faulted";
                await promise.InvokeAsync("reject", WebView, WebView.Factory.CreateString(errormessage));
            });
        }
        private async void SetResult(IJavascriptObject promise, IJsCsGlue bridgevalue)
        {
            if (promise == null)
            {
                return;
            }

            await WebView.RunAsync(async() =>
            {
                await promise.InvokeAsync("fullfill", WebView, bridgevalue.GetJsSessionValue());
            });
        }
        public void Reroot(string PropertyName, IJSCSGlue newValue)
        {
            _Attributes[PropertyName] = newValue;

            IJavascriptObject silenter = null;

            if (_Silenters.TryGetValue(PropertyName, out silenter))
            {
                silenter.InvokeAsync("silent", _CefV8Context, newValue.GetJSSessionValue());
            }
            else
            {
                _CefV8Context.RunAsync(() =>
                {
                    var jso = _MappedJSValue;
                    if (!_Silenters.TryGetValue(PropertyName, out silenter))
                    {
                        silenter = jso.GetValue(PropertyName);
                        _Silenters.Add(PropertyName, silenter);
                    }
                    silenter.Invoke("silent", _CefV8Context, newValue.GetJSSessionValue());
                });
            }
        }
 public void ClearAllCollection(IJavascriptObject array)
 {
     array.InvokeAsync("silentremoveAll", _WebView);
 }
 public void SpliceCollection(IJavascriptObject array, int index, int number)
 {
     array.InvokeAsync("silentsplice", _WebView, _WebView.Factory.CreateInt(index), _WebView.Factory.CreateInt(number));
 }
 public void SpliceCollection(IJavascriptObject array, int index, int number)
 {
     array.InvokeAsync("silentSplice", _WebView, _WebView.Factory.CreateInt(index), _WebView.Factory.CreateInt(number));
 }
 public void ClearAllCollection(IJavascriptObject array)
 {
     array.InvokeAsync("silentremoveAll", _WebView);
 }