Ejemplo n.º 1
0
 /// <summary>
 /// Calls a function with the specified arguments in the script environment.
 /// </summary>
 public JSValue CallFunction(string Name, object[] arguments)
 {
     JSCore.JSObject global = GlobalContext.GetGlobalObject();
     JSCore.JSValue  window = global.GetProperty("window");
     if (window == null || !window.IsObject)
     {
         return(null);
     }
     JSCore.JSObject windowObj = window.ToObject();
     return(windowObj.CallFunction(Name, arguments));
 }
Ejemplo n.º 2
0
 internal void CreateWindowScriptObject(JSCore.JSContext context)
 {
     if (ScriptObject != null && context != null)
     {
         JSCore.JSObject global = context.GetGlobalObject();
         JSCore.JSValue  window = global.GetProperty("window");
         if (window == null || !window.IsObject)
         {
             return;
         }
         JSCore.JSObject windowObj = window.ToObject();
         if (windowObj == null)
         {
             return;
         }
         windowObj.SetProperty("external", (object)ScriptObject);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Executes a Script in the Global Context and returns its value.
 /// </summary>
 public JSCore.JSValue EvaluateScript(string Name)
 {
     JSCore.JSValue val = ((JSCore.JSContext)GlobalContext).EvaluateScript(Name);
     return(val != null ? val : null);
 }