JsArray.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Jint.Native.Array;
  2. using Jint.Runtime.Descriptors;
  3. namespace Jint.Native;
  4. public sealed class JsArray : ArrayInstance
  5. {
  6. /// <summary>
  7. /// Creates a new array instance with defaults.
  8. /// </summary>
  9. /// <param name="engine">The engine that this array is bound to.</param>
  10. /// <param name="capacity">The initial size of underlying data structure, if you know you're going to add N items, provide N.</param>
  11. /// <param name="length">Sets the length of the array.</param>
  12. public JsArray(Engine engine, uint capacity = 0, uint length = 0) : base(engine, capacity, length)
  13. {
  14. }
  15. /// <summary>
  16. /// Possibility to construct valid array fast.
  17. /// The array will be owned and modified by Jint afterwards.
  18. /// </summary>
  19. public JsArray(Engine engine, JsValue[] items) : base(engine, items)
  20. {
  21. }
  22. /// <summary>
  23. /// Possibility to construct valid array fast, requires that supplied array does not have holes.
  24. /// The array will be owned and modified by Jint afterwards.
  25. /// </summary>
  26. public JsArray(Engine engine, PropertyDescriptor[] items) : base(engine, items)
  27. {
  28. }
  29. internal JsArray(Engine engine, object[] items) : base(engine, items)
  30. {
  31. }
  32. }