-
Notifications
You must be signed in to change notification settings - Fork 49
(chakra) recursive evaluation #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello, Michael! You could give an example of JS code that causes this error. |
Simple test case: _engine.EmbedHostObject("_test", (Action<string>)(c => _engine.Evaluate(c));
_engine.Evaluate("_test('var test;')"); |
Why are you doing this? You can use a |
What about this: _engine.EmbedHostObject("_test", (Action<string>)(c => _engine.ExecuteFile($"dist/{c}.js"));
_engine.Evaluate("_test('test')"); I'm trying to implement a simple module system. |
Try this variant: Func<string, string> readFileContent = File.ReadAllText;
_engine.EmbedHostObject("readFileContent", readFileContent);
_engine.Execute(@"function loadModule(moduleName) {
var modulePath = 'dist/' + moduleName + '.js';
var moduleContent = readFileContent(modulePath);
return new Function(moduleContent)();
}");
_engine.CallFunction("loadModule", "test"); |
That's my workaround 😄 |
Only here, instead of the |
When there is free time, I will deal with this problem. |
Solution JavaScriptEngineSwitcher/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs Lines 147 to 153 in 753deb7
Which solution do you prefer, or another solution? I can send a PR. |
I'll deal with the problem myself, but later. |
OK, the So it is very difficult to find the right source file. |
Hello, Michael! This error is fixed in version 3.0.8. |
I'm trying to a simple module loading feature which requires recursive script execution:
net -> js -> net -> js
This is currently not possible, because the scriptdispatcher is blocked by the first
eval
.JavaScriptEngineSwitcher/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs
Line 152 in 753deb7
My current workaround is to use eval, which i don't like. Is there any way to make recursive calls work?
The text was updated successfully, but these errors were encountered: