private void button11_Click(object sender, EventArgs e) { //very basic *** //----------------- //test loki.js //this needs EspressoHostForTsc //----------------- string currentDir = System.IO.Directory.GetCurrentDirectory(); string esprima_code = File.ReadAllText("../../Samples/js_tools/lokijs/lokijs.js"); StringBuilder stbuilder = new StringBuilder(); stbuilder.Append(esprima_code); //----------------- int version = JsBridge.LibVersion; #if DEBUG JsBridge.dbugTestCallbacks(); #endif using (JsEngine engine = new JsEngine()) using (JsContext ctx = engine.CreateContext(new MyJsTypeDefinitionBuilder())) { GC.Collect(); System.Diagnostics.Stopwatch stwatch = new System.Diagnostics.Stopwatch(); stwatch.Reset(); stwatch.Start(); var my_expr_ext = new EspressoHostForLoki(); ctx.SetVariableAutoWrap("my_expr_ext", my_expr_ext); string testsrc = @" function require(file){ my_expr_ext.Require(file); } (function(){ var db = new loki('loki.json'); //test log my_expr_ext.ConsoleLog(db); db.save(); })()"; stbuilder.Append(testsrc); ctx.Execute(stbuilder.ToString()); stwatch.Stop(); Console.WriteLine("met1 template:" + stwatch.ElapsedMilliseconds.ToString()); } }
private void button11_Click(object sender, EventArgs e) { //very basic *** //----------------- //test loki.js //this needs EspressoHostForTsc //----------------- string esprima_code = File.ReadAllText("d:\\projects\\Espresso\\js_tools\\lokijs\\lokijs.js"); StringBuilder stbuilder = new StringBuilder(); stbuilder.Append(esprima_code); //----------------- int version = JsBridge.LibVersion; JsBridge.dbugTestCallbacks(); using (JsEngine engine = new JsEngine()) using (JsContext ctx = engine.CreateContext(new MyJsTypeDefinitionBuilder())) { GC.Collect(); System.Diagnostics.Stopwatch stwatch = new System.Diagnostics.Stopwatch(); stwatch.Reset(); stwatch.Start(); var my_expr_ext = new EspressoHostForLoki(); ctx.SetVariableAutoWrap("my_expr_ext", my_expr_ext); string testsrc = @" function require(file){ my_expr_ext.Require(file); } (function(){ var db = new loki('loki.json'); //test log my_expr_ext.ConsoleLog(db); db.save(); })()"; stbuilder.Append(testsrc); ctx.Execute(stbuilder.ToString()); stwatch.Stop(); Console.WriteLine("met1 template:" + stwatch.ElapsedMilliseconds.ToString()); } }