1
1
using CSharpToJavaScript . Utils ;
2
2
3
-
4
3
namespace CSharpToJavaScript . APIs . JS
5
4
{
6
5
[ To ( ToAttribute . FirstCharToLowerCase ) ]
@@ -11,13 +10,151 @@ public partial class GlobalObject
11
10
public class GlobalThis : GlobalObject
12
11
{
13
12
public static Window Window { get ; } = new ( ) ;
14
- public static console Console { get ; set ; } = new ( ) ;
13
+ public static console Console { get ; } = new ( ) ;
14
+
15
+
16
+ //
17
+ //https://262.ecma-international.org/14.0/#sec-constructor-properties-of-the-global-object
18
+ //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
19
+ //
20
+ //As far as I can understand, you can only access Global Object through GlobalThis in Classes.
21
+ //It's only beneficial! We can emulate construction without "new" like GlobalThis.Date()
22
+ //
23
+ //
24
+ //Not included:
25
+ //ArrayBuffer, BigInt64Array, BigUint64Array, DataView, FinalizationRegistry,
26
+ //Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Map, Promise,
27
+ //Proxy, Set, SharedArrayBuffer, Uint8Array, Uint8ClampedArray, Uint16Array,
28
+ //Uint32Array, WeakMap, WeakRef, WeakSet
29
+ /*
30
+ [To(ToAttribute.Default)]
31
+ public static AggregateError AggregateError(dynamic errors, dynamic? message = null,dynamic? options = null)
32
+ {
33
+ throw new System.NotImplementedException();
34
+ }
35
+ */
36
+ /*
37
+ [To(ToAttribute.Default)]
38
+ public static Array Array(params dynamic[] values)
39
+ {
40
+ throw new System.NotImplementedException();
41
+ }
42
+ */
43
+ /*
44
+ [To(ToAttribute.Default)]
45
+ public static BigInt BigInt(dynamic value)
46
+ {
47
+ throw new System.NotImplementedException();
48
+ }
49
+ */
50
+
51
+ [ To ( ToAttribute . Default ) ]
52
+ public static bool Boolean ( dynamic value )
53
+ {
54
+ throw new System . NotImplementedException ( ) ;
55
+ }
15
56
16
57
[ To ( ToAttribute . Default ) ]
17
- public static string Date ( string x )
58
+ public static string Date ( )
18
59
{
19
60
throw new System . NotImplementedException ( ) ;
20
61
}
62
+
63
+ /*
64
+ [To(ToAttribute.Default)]
65
+ public static Error Error(dynamic message, dynamic? options = null)
66
+ {
67
+ throw new System.NotImplementedException();
68
+ }*/
69
+
70
+ /*
71
+ [To(ToAttribute.Default)]
72
+ public static EvalError EvalError(dynamic message, dynamic? options = null)
73
+ {
74
+ throw new System.NotImplementedException();
75
+
76
+ }*/
77
+
78
+ //https://262.ecma-international.org/14.0/#sec-function-p1-p2-pn-body
79
+ //see NOTE!
80
+ [ To ( ToAttribute . Default ) ]
81
+ public static Function Function ( dynamic parameterArgs , dynamic ? bodyArg = null )
82
+ {
83
+ throw new System . NotImplementedException ( ) ;
84
+
85
+ }
86
+
87
+ [ To ( ToAttribute . Default ) ]
88
+ public static double Number ( dynamic value )
89
+ {
90
+ throw new System . NotImplementedException ( ) ;
91
+
92
+ }
93
+
94
+ [ To ( ToAttribute . Default ) ]
95
+ public static Object Object ( dynamic ? value = null )
96
+ {
97
+ throw new System . NotImplementedException ( ) ;
98
+
99
+ }
100
+ /*
101
+ [To(ToAttribute.Default)]
102
+ public static RangeError RangeError(dynamic message, dynamic? options = null)
103
+ {
104
+ throw new System.NotImplementedException();
105
+
106
+ }*/
107
+ /*
108
+ [To(ToAttribute.Default)]
109
+ public static ReferenceError ReferenceError(dynamic message, dynamic? options = null)
110
+ {
111
+ throw new System.NotImplementedException();
112
+
113
+ }*/
114
+
115
+ [ To ( ToAttribute . Default ) ]
116
+ public static string RegExp ( string pattern , string ? flags = null )
117
+ {
118
+ throw new System . NotImplementedException ( ) ;
119
+
120
+ }
121
+
122
+ [ To ( ToAttribute . Default ) ]
123
+ public static string String ( dynamic value )
124
+ {
125
+ throw new System . NotImplementedException ( ) ;
126
+
127
+ }
128
+
129
+ /*
130
+ [To(ToAttribute.Default)]
131
+ public static Symbol Symbol(dynamic? description = null)
132
+ {
133
+ throw new System.NotImplementedException();
134
+
135
+ }*/
136
+ /*
137
+ [To(ToAttribute.Default)]
138
+ public static SyntaxError SyntaxError(dynamic message, dynamic? options = null)
139
+ {
140
+ throw new System.NotImplementedException();
141
+
142
+ }*/
143
+ /*
144
+ [To(ToAttribute.Default)]
145
+ public static TypeError TypeError(dynamic message, dynamic? options = null)
146
+ {
147
+ throw new System.NotImplementedException();
148
+
149
+ }*/
150
+ /*
151
+ [To(ToAttribute.Default)]
152
+ public static URIError URIError(dynamic message, dynamic? options = null)
153
+ {
154
+ throw new System.NotImplementedException();
155
+
156
+ }*/
157
+
21
158
}
22
159
23
160
[ To ( ToAttribute . Default ) ]
@@ -37,21 +174,6 @@ public class Undefined
37
174
38
175
}
39
176
40
- //Do I need this? TODO!
41
- //https://262.ecma-international.org/14.0/#sec-constructor-properties-of-the-global-object
42
- //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
43
- //
44
- //DO THIS IN !GlobalThis!
45
- //As far as I can understand, you can only access Global Object through GlobalThis in Classes.
46
- //It's only beneficial! We can emulate construction without "new" like GlobalThis.Date()
47
- //DO THIS IN !GlobalThis!
48
- //
49
- //[To(ToAttribute.Default)]
50
- //public static string Date(string x)
51
- //{
52
- //throw new System.NotImplementedException();
53
- //}
54
-
55
177
[ To ( ToAttribute . FirstCharToLowerCase ) ]
56
178
public static dynamic Eval ( string x )
57
179
{
0 commit comments