Realm.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Jint.Native;
  2. using Jint.Native.Object;
  3. using Jint.Runtime.Environments;
  4. namespace Jint.Runtime
  5. {
  6. public sealed class Realm
  7. {
  8. internal readonly Dictionary<Node, JsArray> _templateMap = new();
  9. // helps when debugging which nested realm we are in...
  10. #if DEBUG
  11. private static int globalId = 1;
  12. public Realm()
  13. {
  14. Id = globalId++;
  15. }
  16. internal int Id;
  17. #endif
  18. /// <summary>
  19. /// The intrinsic values used by code associated with this realm.
  20. /// </summary>
  21. public Intrinsics Intrinsics { get; internal set; } = null!;
  22. /// <summary>
  23. /// The global object for this realm.
  24. /// </summary>
  25. public ObjectInstance GlobalObject { get; internal set; } = null!;
  26. /// <summary>
  27. /// The global environment for this realm.
  28. /// </summary>
  29. internal GlobalEnvironment GlobalEnv { get; set; } = null!;
  30. /// <summary>
  31. /// Field reserved for use by hosts that need to associate additional information with a Realm Record.
  32. /// </summary>
  33. public object? HostDefined { get; set; }
  34. }
  35. }