Realm.cs 1.0 KB

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