Ejemplo n.º 1
0
        public FREObject CallJavascriptFunction(FREContext ctx, uint argc, FREObject[] argv)
        {
            var js          = Convert.ToString(new FreObjectSharp(argv[0]).Value);
            var callbackFre = new FreObjectSharp(argv[1]);

            if (FreObjectTypeSharp.Null == callbackFre.GetType())
            {
                CallJavascriptFunction(js);
            }
            else
            {
                var callback = Convert.ToString(callbackFre.Value);
                CallJavascriptFunction(js, callback);
            }
            return(FREObject.Zero);
        }
Ejemplo n.º 2
0
        public FREObject EvaluateJavaScript(FREContext ctx, uint argc, FREObject[] argv)
        {
            var js          = new FreObjectSharp(argv[0]).GetAsString();
            var callbackFre = new FreObjectSharp(argv[1]);

            if (FreObjectTypeSharp.Null == callbackFre.GetType())
            {
                EvaluateJavaScript(js);
            }
            else
            {
                var callback = callbackFre.GetAsString();
                EvaluateJavaScript(js, callback);
            }
            return(FREObject.Zero);
        }
Ejemplo n.º 3
0
        public FREObject InjectScript(FREContext ctx, uint argc, FREObject[] argv)
        {
            var injectCodeFre      = new FreObjectSharp(argv[0]);
            var injectScriptUrlFre = new FreObjectSharp(argv[1]);
            var injectStartLineFre = new FreObjectSharp(argv[2]);

            if (FreObjectTypeSharp.String == injectCodeFre.GetType())
            {
                _view.InjectCode = Convert.ToString(injectCodeFre.Value);
            }
            if (FreObjectTypeSharp.String == injectScriptUrlFre.GetType())
            {
                _view.InjectScriptUrl = Convert.ToString(injectScriptUrlFre.Value);
            }
            _view.InjectStartLine = Convert.ToInt32(injectStartLineFre.Value);

            return(FREObject.Zero);
        }
Ejemplo n.º 4
0
        public FREObject EvaluateJavaScript(FREContext ctx, uint argc, FREObject[] argv)
        {
            try {
                var js          = Convert.ToString(new FreObjectSharp(argv[0]).Value);
                var callbackFre = new FreObjectSharp(argv[1]);

                if (FreObjectTypeSharp.Null == callbackFre.GetType())
                {
                    EvaluateJavaScript(js);
                }
                else
                {
                    var callback = Convert.ToString(callbackFre.Value);
                    EvaluateJavaScript(js, callback);
                }
            }
            catch (Exception e) {
                return(new FreException(e).RawValue);
            }
            return(FREObject.Zero);
        }