Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class setTimeout : V8Function
- {
- public override ObjectHandle Initialize(bool isConstructCall, params InternalHandle[] args)
- {
- Callback = setTimeoutConstructWrapper;
- return base.Initialize(isConstructCall, args);
- }
- public InternalHandle setTimeoutConstructWrapper(V8Engine engine, bool isConstructCall, InternalHandle _this, params InternalHandle[] args)
- {
- Thread.Sleep(args[1]);
- return args[0].Call(null);
- }
- }
- V8Engine v8Engine = new V8Engine();
- var funcTemplate = v8Engine.CreateFunctionTemplate(typeof(setTimeout).Name);
- var testerFunc = funcTemplate.GetFunctionObject<setTimeout>();
- v8Engine.DynamicGlobalObject.setTimeout = testerFunc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement