Exemplo n.º 1
0
        private void CallInstanceMethod(string name)
        {
            if (!jsInstance.HasValue)
            {
                return;
            }


            Engine.WithIfRunning(() => {
                JavaScriptValue method = jsInstance.Value.GetProperty(name);
                if (method.ValueType == JavaScriptValueType.Function)
                {
                    method.CallFunction(jsInstance.Value);
                }

                JavaScriptValue _delegates = jsInstance.Value.GetProperty("_delegates");
                foreach (JavaScriptValue instance in _delegates.ToList())
                {
                    JavaScriptValue delegateMethod = instance.GetProperty(name);
                    if (delegateMethod.ValueType == JavaScriptValueType.Function)
                    {
                        delegateMethod.CallFunction(instance);
                    }
                }
            });
        }