Beispiel #1
0
        /// <summary>
        /// Gets or sets the Array with the index specified by <paramref name="i" />.
        /// </summary>
        /// <param name="i">The index.</param>
        public object this[int i]
        {
            get
            {
                this.AssertNotDisposed();

                Interop.Runtime.GetByIndexRef(JSHandle, i, out int exception, out object indexValue);

                if (exception != 0)
                {
                    throw new JSException((string)indexValue);
                }
                JSHostImplementation.ReleaseInFlight(indexValue);
                return(indexValue);
            }
            set
            {
                this.AssertNotDisposed();

                Interop.Runtime.SetByIndexRef(JSHandle, i, value, out int exception, out object res);

                if (exception != 0)
                {
                    throw new JSException((string)res);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the DataView class.
 /// </summary>
 /// <param name="buffer">ArrayBuffer to use as the storage backing the new DataView object.</param>
 /// <param name="byteOffset">The offset, in bytes, to the first byte in the above buffer for the new view to reference. If unspecified, the buffer view starts with the first byte.</param>
 /// <param name="byteLength">The number of elements in the byte array. If unspecified, the view's length will match the buffer's length.</param>
 public DataView(ArrayBuffer buffer, int byteOffset, int byteLength)
     : base(JavaScriptImports.CreateCSOwnedObject(nameof(DataView), new object[] { buffer, byteOffset, byteLength }))
 {
     JSHostImplementation.RegisterCSOwnedObject(this);
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the DataView class.
 /// </summary>
 /// <param name="buffer">ArrayBuffer to use as the storage backing the new DataView object.</param>
 public DataView(ArrayBuffer buffer)
     : base(JavaScriptImports.CreateCSOwnedObject(nameof(DataView), new object[] { buffer }))
 {
     JSHostImplementation.RegisterCSOwnedObject(this);
 }
Beispiel #4
0
 public Function(params object[] args)
     : base(JavaScriptImports.CreateCSOwnedObject(nameof(Function), args))
 {
     JSHostImplementation.RegisterCSOwnedObject(this);
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the Array class.
 /// </summary>
 /// <param name="_params">Parameters.</param>
 public Array(params object[] _params)
     : base(JavaScriptImports.CreateCSOwnedObject(nameof(Array), _params))
 {
     JSHostImplementation.RegisterCSOwnedObject(this);
 }
Beispiel #6
0
 public Uint8Array(int length)
     : base(JavaScriptImports.CreateCSOwnedObject(nameof(Uint8Array), new object[] { length }))
 {
     JSHostImplementation.RegisterCSOwnedObject(this);
 }
Beispiel #7
0
 public ActionJS(IntPtr jsHandle)
 {
     JSObject = JSHostImplementation.CreateCSOwnedProxy(jsHandle);
 }