New Post: Are multiline strings possible?
Hi again, The JSON object is a JavaScript built-in. If you're using V8, it should be there by default. JScript on the other hand implements an older JavaScript standard by default - one that doesn't...
View ArticleNew Post: Does ClearScript have memory leak?
Hello JerryBian! Are you using V8? That script engine heavily favors performance over memory efficiency, and is particularly lazy when it comes to garbage collection. If you use a single long-lived...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
So here's the scenario I'm working with: I have a data coming in from a socket and I'd like to have user provided javascript components processing that data. I have js that conceptually looks like...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
Greetings! Thank you for the positive feedback!​ Is this a good idea? Should I be holding on to references to functions that exist in the script the way I am? Are there bad performance implications of...
View ArticleNew Post: Does ClearScript have memory leak?
Hi ClearScript, Thanks for your answer, I have a quick question: should I create a new instance of VBScriptEngine each time or use a single instance globally?
View ArticleNew Post: Does ClearScript have memory leak?
Hi again, Regarding your first question, there are several considerations. Do you need to run scripts concurrently? Are your scripts independent, or do they reuse data left over by other scripts? Are...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
That's just what I needed to know. I'll give it a try using the runtime to spawn the needed engines as I indeed need concurrent execution and it would ensure a pristine script environment. Thanks so...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
No problem at all! Just to clarify, each V8 runtime supports single-threaded access only, but multiple runtimes can operate concurrently. In ClearScript, the V8ScriptEngine constructor creates a...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
Just to make sure I understand correctly: If I were to use one V8Runtime to efficiently spawn the needed engines, in my scenario each engine would only be tied to one script and the script would be...
View ArticleNew Post: Holding references in C# to functions that exist in JS and cleanup
Hi again,​ So in the end, the functions which are contained in the script and hence each engine, would be accessed concurrently. And that is not supported because of the shared runtime, right?​ That's...
View ArticleNew Post: Raise a custom exception
Hi ClearScripts, I would like to raise an excpetion within the JavaScript code. For sure I may raise the Error object but I need to have something more specific. I didn't find out how to raise an .NET...
View ArticleNew Post: Raise a custom exception
Hello, Torsten! You can easily expose a function that throws a host exception. For example: engine.Script.throwBadArg = new Action<string, string>((message, paramName) => { thrownew...
View ArticleNew Post: Raise a custom exception
Thanks for your answer! As I see, I cannotidentify in the host application a JavaScript defined exception, likefunction myException(message, { this.name = 'myException'; this.message = message + ' ' +...
View ArticleNew Post: Can we load other javascripts from javascript?
I hava a question. We can load other javascripts from javascript with load("xxx.js") with Rhino. Can we load other javascripts from javascript with ClearScript? Could you tell me how we can do for this...
View ArticleNew Post: Raise a custom exception
That's correct. ClearScript doesn't expose managed exceptions directly to script-based handlers. The best approach is to catch managed exceptions in managed code and pass them to script code for...
View ArticleNew Post: Can we load other javascripts from javascript?
Hello! You can easily expose a Rhino-like load() function:publicdelegatevoid LoadFunc(paramsstring[] paths); // ... engine.Script.load = new LoadFunc(paths => { foreach (var path in paths) {...
View ArticleNew Post: Does ClearScript have memory leak?
Hi ClearScript, I would try to provide as more information as possible. Users can execute some custom scripts targets to our system, in our server side, we plan to use ClearScript(V8ScriptEngine) to...
View ArticleNew Post: Build bug found for Visual Studio 2010
Hello, I was trying to build on Windows 7 x64, but was having issues. After a bit of debugging I've "solved" the issue for me. I'm just posting to make you aware if you aren't already. It's a simple...
View ArticleNew Post: Enable Experimental JavaScript
I am looking to toy with javascript proxies how can I set v8 to enable experimental javascript?
View ArticleNew Post: Build bug found for Visual Studio 2010
Greetings! As you've discovered, a full ClearScript build requires Visual Studio 2012 or 2013. A "NoV8" or custom build may be possible with an earlier Visual Studio version, but we don't test with...
View Article