Skip to content

Commit 880e3b6

Browse files
committed
Added ArrayBuffer, Atomics, DataView, JSON, Map, Set, SharedArrayBuffer, WeakMap, WeakSet.
1 parent 55d6ba3 commit 880e3b6

File tree

10 files changed

+462
-49
lines changed

10 files changed

+462
-49
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
6+
namespace CSharpToJavaScript.APIs.JS.Ecma;
7+
8+
//https://262.ecma-international.org/14.0/#sec-arraybuffer-objects
9+
[To(ToAttribute.Default)]
10+
public partial class ArrayBuffer : ArrayBufferPrototype
11+
{
12+
[To(ToAttribute.FirstCharToLowerCase)]
13+
public static ArrayBufferPrototype Prototype { get; } = new();
14+
public ArrayBuffer(int length) { }
15+
16+
[To(ToAttribute.FirstCharToLowerCase)]
17+
public static bool IsView(Object arg)
18+
{
19+
throw new System.NotImplementedException();
20+
}
21+
}
22+
23+
[To(ToAttribute.FirstCharToLowerCase)]
24+
public class ArrayBufferPrototype : FunctionPrototype
25+
{
26+
public int ByteLength { get; } = 0;
27+
public ArrayBufferPrototype() { }
28+
public ArrayBuffer Slice(int start = 0, int end = 0)
29+
{
30+
throw new System.NotImplementedException();
31+
}
32+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
using System;
6+
using System.Drawing;
7+
8+
namespace CSharpToJavaScript.APIs.JS.Ecma;
9+
10+
[To(ToAttribute.Default)]
11+
public partial class Atomics : ObjectPrototype
12+
{
13+
[To(ToAttribute.FirstCharToLowerCase)]
14+
public dynamic And<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
15+
{
16+
throw new System.NotImplementedException();
17+
}
18+
19+
[To(ToAttribute.FirstCharToLowerCase)]
20+
public dynamic CompareExchange<T>(T typedArray, int index, dynamic expectedValue, dynamic replacementValue) where T : TypedArray<T>
21+
{
22+
throw new System.NotImplementedException();
23+
}
24+
[To(ToAttribute.FirstCharToLowerCase)]
25+
public dynamic Exchange<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
26+
{
27+
throw new System.NotImplementedException();
28+
}
29+
[To(ToAttribute.FirstCharToLowerCase)]
30+
public bool IsLockFree(int size )
31+
{
32+
throw new System.NotImplementedException();
33+
}
34+
[To(ToAttribute.FirstCharToLowerCase)]
35+
public dynamic Load<T>(T typedArray,int index) where T : TypedArray<T>
36+
{
37+
throw new System.NotImplementedException();
38+
}
39+
[To(ToAttribute.FirstCharToLowerCase)]
40+
public dynamic Or<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
41+
{
42+
throw new System.NotImplementedException();
43+
}
44+
[To(ToAttribute.FirstCharToLowerCase)]
45+
public dynamic Store<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
46+
{
47+
throw new System.NotImplementedException();
48+
}
49+
[To(ToAttribute.FirstCharToLowerCase)]
50+
public dynamic Sub<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
51+
{
52+
throw new System.NotImplementedException();
53+
}
54+
[To(ToAttribute.FirstCharToLowerCase)]
55+
public string Wait<T>(T typedArray, int index, dynamic value, int wait = 0) where T : TypedArray<T>
56+
{
57+
throw new System.NotImplementedException();
58+
}
59+
[To(ToAttribute.FirstCharToLowerCase)]
60+
public int Notify<T>(T typedArray, int index, int count = 0) where T : TypedArray<T>
61+
{
62+
throw new System.NotImplementedException();
63+
}
64+
[To(ToAttribute.FirstCharToLowerCase)]
65+
public dynamic Xor<T>(T typedArray, int index, dynamic value) where T : TypedArray<T>
66+
{
67+
throw new System.NotImplementedException();
68+
}
69+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
using System;
6+
7+
namespace CSharpToJavaScript.APIs.JS.Ecma;
8+
9+
[To(ToAttribute.Default)]
10+
public partial class DataView : DataViewPrototype
11+
{
12+
[To(ToAttribute.FirstCharToLowerCase)]
13+
public static DataViewPrototype Prototype { get; } = new();
14+
public DataView(ArrayBuffer buffer, int byteOffset = 0, int byteLength = 0) { }
15+
}
16+
[To(ToAttribute.FirstCharToLowerCase)]
17+
public class DataViewPrototype : FunctionPrototype
18+
{
19+
public ArrayBuffer Buffer { get; } = new(0);
20+
public int ByteLength { get; } = 0;
21+
public int ByteOffset { get; } = 0;
22+
23+
public DataViewPrototype() { }
24+
25+
public BigInt GetBigInt64(int byteOffset, bool littleEndian = true)
26+
{
27+
throw new System.NotImplementedException();
28+
}
29+
public BigInt GetUBigInt64(int byteOffset, bool littleEndian = true)
30+
{
31+
throw new System.NotImplementedException();
32+
}
33+
public float GetFloat32(int byteOffset, bool littleEndian = true)
34+
{
35+
throw new System.NotImplementedException();
36+
}
37+
public float GetFloat64(int byteOffset, bool littleEndian = true)
38+
{
39+
throw new System.NotImplementedException();
40+
}
41+
public int GetInt8(int byteOffset)
42+
{
43+
throw new System.NotImplementedException();
44+
}
45+
public int GetInt16(int byteOffset, bool littleEndian = true)
46+
{
47+
throw new System.NotImplementedException();
48+
}
49+
public int GetInt32(int byteOffset, bool littleEndian = true)
50+
{
51+
throw new System.NotImplementedException();
52+
}
53+
public int GetUint8(int byteOffset)
54+
{
55+
throw new System.NotImplementedException();
56+
}
57+
public int GetUint16(int byteOffset, bool littleEndian = true)
58+
{
59+
throw new System.NotImplementedException();
60+
}
61+
public int GetUint32(int byteOffset, bool littleEndian = true)
62+
{
63+
throw new System.NotImplementedException();
64+
}
65+
public GlobalObject.Undefined SetBigInt64(int byteOffset, dynamic value, bool littleEndian = true)
66+
{
67+
throw new System.NotImplementedException();
68+
}
69+
public GlobalObject.Undefined SetBigUint64(int byteOffset, dynamic value, bool littleEndian = true)
70+
{
71+
throw new System.NotImplementedException();
72+
}
73+
public GlobalObject.Undefined SetFloat32(int byteOffset, dynamic value, bool littleEndian = true)
74+
{
75+
throw new System.NotImplementedException();
76+
}
77+
public GlobalObject.Undefined SetFloat64(int byteOffset, dynamic value, bool littleEndian = true)
78+
{
79+
throw new System.NotImplementedException();
80+
}
81+
public GlobalObject.Undefined SetInt8(int byteOffset, dynamic value)
82+
{
83+
throw new System.NotImplementedException();
84+
}
85+
public GlobalObject.Undefined SetInt16(int byteOffset, dynamic value, bool littleEndian = true)
86+
{
87+
throw new System.NotImplementedException();
88+
}
89+
public GlobalObject.Undefined SetInt32(int byteOffset, dynamic value, bool littleEndian = true)
90+
{
91+
throw new System.NotImplementedException();
92+
}
93+
public GlobalObject.Undefined SetUint8(int byteOffset, dynamic value)
94+
{
95+
throw new System.NotImplementedException();
96+
}
97+
public GlobalObject.Undefined SetUint16(int byteOffset, dynamic value, bool littleEndian = true)
98+
{
99+
throw new System.NotImplementedException();
100+
}
101+
public GlobalObject.Undefined SetUint32(int byteOffset, dynamic value, bool littleEndian = true)
102+
{
103+
throw new System.NotImplementedException();
104+
}
105+
106+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
using System;
6+
7+
namespace CSharpToJavaScript.APIs.JS.Ecma;
8+
9+
//https://262.ecma-international.org/14.0/#sec-json-object
10+
[To(ToAttribute.Default)]
11+
public partial class JSON : ObjectPrototype
12+
{
13+
[To(ToAttribute.FirstCharToLowerCase)]
14+
public static dynamic? Parse(string text, Action? reviver = null)
15+
{
16+
throw new System.NotImplementedException();
17+
}
18+
[To(ToAttribute.FirstCharToLowerCase)]
19+
public static string? Stringify(dynamic value, Action? replacer = null, string space = "")
20+
{
21+
throw new System.NotImplementedException();
22+
}
23+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
using System;
6+
using System.Collections.Generic;
7+
8+
namespace CSharpToJavaScript.APIs.JS.Ecma;
9+
10+
//TODO? Generic variant? or replace with generic???
11+
//That way, I can replace the Dictionary in the generated cs. See GenCSharpLib.
12+
//Or, I cant...
13+
//spec: https://w3c.github.io/clipboard-apis/#dom-clipboarditem-clipboarditem
14+
//mdn js: https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem
15+
//First parameter is an object in js, but in webidl is a record...
16+
17+
//https://262.ecma-international.org/14.0/#sec-map-objects
18+
[To(ToAttribute.Default)]
19+
public partial class Map : MapPrototype
20+
{
21+
[To(ToAttribute.FirstCharToLowerCase)]
22+
public static MapPrototype Prototype { get; } = new();
23+
public Map(Array? iterable = default) { }
24+
25+
}
26+
[To(ToAttribute.FirstCharToLowerCase)]
27+
public class MapPrototype : FunctionPrototype
28+
{
29+
public int Size { get; } = 0;
30+
public MapPrototype() { }
31+
32+
public GlobalObject.Undefined Clear()
33+
{
34+
throw new System.NotImplementedException();
35+
}
36+
public bool Delete(dynamic key)
37+
{
38+
throw new System.NotImplementedException();
39+
}
40+
public List<dynamic> Entries()
41+
{
42+
throw new System.NotImplementedException();
43+
}
44+
public GlobalObject.Undefined ForEach(Action callbackfn, dynamic? thisArg = null)
45+
{
46+
throw new System.NotImplementedException();
47+
}
48+
public dynamic? Get(dynamic key)
49+
{
50+
throw new System.NotImplementedException();
51+
}
52+
public bool Has(dynamic key)
53+
{
54+
throw new System.NotImplementedException();
55+
}
56+
public List<dynamic> Keys()
57+
{
58+
throw new System.NotImplementedException();
59+
}
60+
public Map Set(dynamic key, dynamic value)
61+
{
62+
throw new System.NotImplementedException();
63+
}
64+
public List<dynamic> Values()
65+
{
66+
throw new System.NotImplementedException();
67+
}
68+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
4+
using CSharpToJavaScript.Utils;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace CSharpToJavaScript.APIs.JS.Ecma;
12+
13+
//https://262.ecma-international.org/14.0/#sec-set-objects
14+
[To(ToAttribute.Default)]
15+
public partial class Set : SetPrototype
16+
{
17+
[To(ToAttribute.FirstCharToLowerCase)]
18+
public static SetPrototype Prototype { get; } = new();
19+
public Set(Array? iterable = default) { }
20+
}
21+
22+
[To(ToAttribute.FirstCharToLowerCase)]
23+
public class SetPrototype : FunctionPrototype
24+
{
25+
public int Size { get; } = 0;
26+
public SetPrototype() { }
27+
public Set Add(dynamic value)
28+
{
29+
throw new System.NotImplementedException();
30+
}
31+
public GlobalObject.Undefined Clear()
32+
{
33+
throw new System.NotImplementedException();
34+
}
35+
public bool Delete(dynamic value)
36+
{
37+
throw new System.NotImplementedException();
38+
}
39+
public List<dynamic> Entries()
40+
{
41+
throw new System.NotImplementedException();
42+
}
43+
public GlobalObject.Undefined ForEach(Action callbackfn, dynamic? thisArg = null)
44+
{
45+
throw new System.NotImplementedException();
46+
}
47+
public bool Has(dynamic value)
48+
{
49+
throw new System.NotImplementedException();
50+
}
51+
public List<dynamic> Keys()
52+
{
53+
throw new System.NotImplementedException();
54+
}
55+
public List<dynamic> Values()
56+
{
57+
throw new System.NotImplementedException();
58+
}
59+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//TODO! Disable missing XML comments.
2+
#pragma warning disable CS1591
3+
using CSharpToJavaScript.Utils;
4+
5+
namespace CSharpToJavaScript.APIs.JS.Ecma;
6+
7+
//https://262.ecma-international.org/14.0/#sec-sharedarraybuffer-objects
8+
[To(ToAttribute.Default)]
9+
public partial class SharedArrayBuffer : SharedArrayBufferPrototype
10+
{
11+
[To(ToAttribute.FirstCharToLowerCase)]
12+
public static SharedArrayBufferPrototype Prototype { get; } = new();
13+
public SharedArrayBuffer(int length) { }
14+
15+
}
16+
[To(ToAttribute.FirstCharToLowerCase)]
17+
public class SharedArrayBufferPrototype : FunctionPrototype
18+
{
19+
public int ByteLength { get; } = 0;
20+
public SharedArrayBufferPrototype() { }
21+
public SharedArrayBuffer Slice(int start = 0, int end = 0)
22+
{
23+
throw new System.NotImplementedException();
24+
}
25+
}

0 commit comments

Comments
 (0)