public Object(Jurassic.ScriptEngine engine) : base(engine) { }
/// <summary> /// Generates a method that does type conversion and calls the bound method. /// </summary> /// <param name="generator"> The ILGenerator used to output the body of the method. </param> /// <param name="argumentCount"> The number of arguments that will be passed to the delegate. </param> /// <returns> A delegate that does type conversion and calls the method represented by this /// object. </returns> protected override void GenerateStub(Jurassic.Compiler.ILGenerator generator, int argumentCount) { // Emit undefined. EmitHelpers.EmitUndefined(generator); // End the IL. generator.Complete(); }
// Helper method. private System.Numerics.BigInteger Convert(Jurassic.BigInteger value) { var result = System.Numerics.BigInteger.Zero; for (int i = value.WordCount - 1; i >= 0; i --) { result <<= 32; result += value.Words[i]; } if (value.Sign == -1) result = result * -1; return result; }
// set/clear timeout/inveral public void setTimeout(Jurassic.Library.FunctionInstance callback, int ms) { timers.Create((float)ms / 1000, false, () => callback.Call(js.Global)); }
public void setInterval(Jurassic.Library.FunctionInstance callback, int ms) { float target = ms < 34 ? 0 : (float)ms / 1000; // make sure a timer with a target <= 33ms is fired each frame timers.Create(target, true, () => callback.Call(js.Global)); }
/// <summary> /// Initialize the context for Jurassic JavaScript run-time /// </summary> /// <param name="javascriptContext"></param> public DynamicJavascriptContext(Jurassic.ScriptEngine javascriptContext){ _javaScriptContextImplementation = new JurassicJavaScriptContextImplementation(javascriptContext); DynamicJavaScriptInstance.___globalJavaScriptContext = _javaScriptContextImplementation; }