This project has moved. For the latest updates, please go here.

[question] has some invalid arguments

Aug 15, 2013 at 8:49 AM
hi,jurassic is powerful ,I love it
and I got a issue here
(function () { "use strict";
var Main = function() { }

Main.hi=function(){
Debug.Log("hi");
}
Main.main = function() {
    Timer.SetTimeout(Main.hi,1000);
   Main.hi();
}
Main.main();
})();
/////////////////

and I defined settimeout here
 public static IDisposable SetTimeout(Action method, int delayInMilliseconds)
    {
        System.Timers.Timer timer = new System.Timers.Timer(delayInMilliseconds);
        timer.Elapsed += (source, e) =>
        {
            method();
        };

        timer.AutoReset = false;
        timer.Enabled = true;
        timer.Start();

        // Returns a stop handle which can be used for stopping
        // the timer, if required
        return timer as IDisposable;
    }
and my error:
JavaScriptException: TypeError: The best method overload IDisposable SetTimeout(System.Action, Int32) has some invalid arguments
Jurassic.Compiler.BinderUtilities.ResolveOverloads (System.RuntimeMethodHandle[],Jurassic.ScriptEngine,object,object[]) <IL 0x003b5, 0x010c3>
(wrapper dynamic-method) object.binder_for_EasyTimer.SetTimeout (Jurassic.ScriptEngine,object,object[]) <IL 0x00015, 0x0008c>

how can I fixed this settimeout call  js function  problem? thanks 
Coordinator
Aug 15, 2013 at 8:12 PM
You should change your SetTimeout method so that it accepts a Jurassic.Library.FunctionInstance (instead of Action). This type represents a javascript function. Then to call the function, use the Call() method.