Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2.  
  3. public class setTimeout : V8Function
  4. {
  5. public override ObjectHandle Initialize(bool isConstructCall, params InternalHandle[] args)
  6. {
  7. Callback = setTimeoutConstructWrapper;
  8.  
  9. return base.Initialize(isConstructCall, args);
  10. }
  11.  
  12. public InternalHandle setTimeoutConstructWrapper(V8Engine engine, bool isConstructCall, InternalHandle _this, params InternalHandle[] args)
  13. {
  14. Thread.Sleep(args[1]);
  15.  
  16. return args[0].Call(null);
  17. }
  18. }
  19.  
  20. V8Engine v8Engine = new V8Engine();
  21. var funcTemplate = v8Engine.CreateFunctionTemplate(typeof(setTimeout).Name);
  22. var testerFunc = funcTemplate.GetFunctionObject<setTimeout>();
  23. v8Engine.DynamicGlobalObject.setTimeout = testerFunc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement