Pause execution or sleep/wait #1059
Replies: 5 comments 2 replies
-
I would suggest to enable debugging, and on a debugger step, check for a ManualResetEvent or TokenEventSource, which would then block when set from an external program. This event handler is call for every statement that is executed. |
Beta Was this translation helpful? Give feedback.
-
Interesting approach. I have checked that and because I have to return a StepMode in the event I cannot make it await a delay. I've also tried to do with Break in the following way: (I've realize that debugger; does not fire the break)
And then search for the wait statements:
So now the only option I have is adding another delegate with Task and recompile Jint with that in order to make it work. |
Beta Was this translation helpful? Give feedback.
-
@sebastienros Could you kindly elaborate on how to enable debugging for the latest version of Jint? Additionally, how do i check for ManualResetEvent or TokenEventSource? Thank you! This feature is very important to me as it will be very useful to run the Jint code statement by statement and also know which statement is running at each time! I could elaborate more about the project I am doing if required. |
Beta Was this translation helpful? Give feedback.
-
@leeyh20 This is how it works: You will need more than that. Might be easier for you to just do some logging on every step. |
Beta Was this translation helpful? Give feedback.
-
Hi @Jither @sebastienros , Using Jint 3.1.0 Also, I am getting the same issue in the statement "e.CurrentCallFrame.ScopeChain.Global.GetBindingValue("o")". like DegugScopes doesn't contain a definition of global here is the Code : using System; namespace JintDebugTestByRanjeet var handler = engine.DebugHandler; private static StepMode Handler_Step(object sender, DebugInformation e) private static StepMode Handler_Break(object sender, DebugInformation e) |
Beta Was this translation helpful? Give feedback.
-
I am new using Jint, so might be there is an standard way to do the following without having issues with the performance.
I am using the following in a UWP app.
To explain what I'm trying to achieve, I have made a test using LUA interpreter and the trick for LUA is calling a C# class to delay and stopping the 'coroutine', then after an await I call to resume and the script continues.
Basically the following:
Now I am trying to do the same with Jint, because I prefer all its functionality.
1.- Is there a way to pause the processing?
2.- Any async/await jint functionality?
The following is what I've tried:
But when I start about 7 scripts, the UI is responding but the scripts are in somehow halted and suddenly continue. Is there a better way to implement this?
Beta Was this translation helpful? Give feedback.
All reactions