Exemplo n.º 1
0
 private Func <string> WrapDelegate(EchoReturnDelegate _delegate)
 {
     return(new Func <string>(() => {
         var returnValue = _delegate();
         return Engine.Converter.AsNativeString(returnValue);
     }));
 }
Exemplo n.º 2
0
 private ClrFunctionInstance WrapDelegate(EchoReturnDelegate _delegate)
 {
     return(Engine.AsJsFunction(new Func <JsValue, JsValue[], JsValue>((thisObject, args) => {
         var returnValue = _delegate();
         return Engine.Converter.AsJsString(returnValue);
     })));
 }
Exemplo n.º 3
0
        } /**
           * Echo the argument via return value from a callback
           */

        public void EchoReturn(String arg, EchoReturnDelegate callback)
        {
            JsValue[] args = new JsValue[] {
                Engine.Converter.AsJsString(arg),
                WrapDelegate(callback)
            };

            var func = this.impl.Get("echoReturn").As <FunctionInstance>();

            Engine.Js(() => {
                func.Call(this.impl, args);
            });
        } /**
Exemplo n.º 4
0
 /**
  * Echo the argument via return value from a callback
  */
 public void EchoReturn(String arg, EchoReturnDelegate callback)
 {
     Engine.Js(() =>
               { this.impl.echoReturn(Engine.Converter.AsJsString(arg),
                                      WrapDelegate(callback)); });
 }