@@ -67,134 +67,127 @@ extern {
67
67
pub fn eval ( js_source_text : & str ) -> Result < JsValue , JsValue > ;
68
68
}
69
69
70
- // Object.
70
+ // Array
71
71
#[ wasm_bindgen]
72
72
extern {
73
- pub type Object ;
73
+ pub type Array ;
74
74
75
- /// The Object constructor creates an object wrapper.
75
+ /// The copyWithin() method shallow copies part of an array to another location in the same
76
+ /// array and returns it, without modifying its size.
76
77
///
77
- /// https ://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
78
- #[ wasm_bindgen( constructor ) ]
79
- pub fn new ( ) -> Object ;
78
+ /// http ://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin
79
+ #[ wasm_bindgen( method , js_name = copyWithin ) ]
80
+ pub fn copy_within ( this : & Array , target : i32 , start : i32 , end : i32 ) -> Array ;
80
81
81
- /// The `hasOwnProperty()` method returns a boolean indicating whether the
82
- /// object has the specified property as its own property (as opposed to
83
- /// inheriting it).
82
+ ///The concat() method is used to merge two or more arrays. This method
83
+ /// does not change the existing arrays, but instead returns a new array.
84
84
///
85
- /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
86
- #[ wasm_bindgen( method, js_name = hasOwnProperty ) ]
87
- pub fn has_own_property ( this : & Object , property : & JsValue ) -> bool ;
85
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
86
+ #[ wasm_bindgen( method) ]
87
+ pub fn concat ( this : & Array , array : & Array ) -> Array ;
88
88
89
- /// The toString() method returns a string representing the object.
89
+ /// The fill() method fills all the elements of an array from a start index to an
90
+ /// end index with a static value. The end index is not included.
90
91
///
91
- /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
92
- #[ wasm_bindgen( method, js_name = toString) ]
93
- pub fn to_string ( this : & Object ) -> String ;
94
-
95
- /// The isPrototypeOf() method checks if an object exists in another
96
- /// object's prototype chain.
97
- ///
98
- /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf
99
- #[ wasm_bindgen( method, js_name = isPrototypeOf) ]
100
- pub fn is_prototype_of ( this : & Object , value : & JsValue ) -> bool ;
101
-
102
- /// The propertyIsEnumerable() method returns a Boolean indicating
103
- /// whether the specified property is enumerable.
104
- ///
105
- /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
106
- #[ wasm_bindgen( method, js_name = propertyIsEnumerable) ]
107
- pub fn property_is_enumerable ( this : & Object , property : & JsValue ) -> bool ;
108
- }
92
+ /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
93
+ #[ wasm_bindgen( method) ]
94
+ pub fn fill ( this : & Array , value : JsValue , start : u32 , end : u32 ) -> Array ;
109
95
110
- // Array
111
- #[ wasm_bindgen]
112
- extern {
113
- pub type Array ;
96
+ /// The length property of an object which is an instance of type Array sets or returns the number of elements in that array.
97
+ /// The value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array.
98
+ ///
99
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length
100
+ #[ wasm_bindgen( method, getter, structural) ]
101
+ pub fn length ( this : & Array ) -> u32 ;
114
102
115
- /// The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
103
+ /// The indexOf() method returns the first index at which a given element can be
104
+ /// found in the array, or -1 if it is not present.
116
105
///
117
106
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
118
107
#[ wasm_bindgen( method, js_name = indexOf) ]
119
108
pub fn index_of ( this : & Array , value : JsValue , from_index : i32 ) -> i32 ;
120
109
121
- /// The lastIndexOf () method returns the last index at which a given element can be found in the array, or -1 if it is not present.
122
- /// The array is searched backwards, starting at fromIndex .
110
+ /// The includes () method determines whether an array includes a certain element,
111
+ /// returning true or false as appropriate .
123
112
///
124
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
125
- #[ wasm_bindgen( method, js_name = lastIndexOf ) ]
126
- pub fn last_index_of ( this : & Array , value : JsValue , from_index : i32 ) -> i32 ;
113
+ /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
114
+ #[ wasm_bindgen( method) ]
115
+ pub fn includes ( this : & Array , value : JsValue , from_index : i32 ) -> bool ;
127
116
128
- /// The join() method joins all elements of an array (or an array-like object) into a string and returns this string.
117
+ /// The join() method joins all elements of an array (or an array-like object)
118
+ /// into a string and returns this string.
129
119
///
130
120
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join
131
121
#[ wasm_bindgen( method) ]
132
122
pub fn join ( this : & Array , delimiter : & str ) -> String ;
133
123
134
- /// The slice() method returns a shallow copy of a portion of an array into a new array
135
- /// object selected from begin to end (end not included).
136
- /// The original array will not be modified.
137
- ///
138
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
139
- #[ wasm_bindgen( method) ]
140
- pub fn slice ( this : & Array , start : u32 , end : u32 ) -> Array ;
141
-
142
- /// The fill() method fills all the elements of an array from a start index to an end index with a static value.
143
- /// The end index is not included.
124
+ /// The lastIndexOf() method returns the last index at which a given element can
125
+ /// be found in the array, or -1 if it is not present. The array is searched
126
+ /// backwards, starting at fromIndex.
144
127
///
145
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
146
- #[ wasm_bindgen( method) ]
147
- pub fn fill ( this : & Array , value : JsValue , start : u32 , end : u32 ) -> Array ;
148
-
149
- /// The copyWithin() method shallow copies part of an array to another location in the same array and returns it, without modifying its size.
150
- ///
151
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin
152
- #[ wasm_bindgen( method, js_name = copyWithin) ]
153
- pub fn copy_within ( this : & Array , target : i32 , start : i32 , end : i32 ) -> Array ;
128
+ /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
129
+ #[ wasm_bindgen( method, js_name = lastIndexOf) ]
130
+ pub fn last_index_of ( this : & Array , value : JsValue , from_index : i32 ) -> i32 ;
154
131
155
- /// The pop() method removes the last element from an array and returns that element. This method changes the length of the array.
132
+ /// The pop() method removes the last element from an array and returns that element.
133
+ /// This method changes the length of the array.
156
134
///
157
135
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop
158
136
#[ wasm_bindgen( method) ]
159
137
pub fn pop ( this : & Array ) -> JsValue ;
160
138
161
- /// The push() method adds one or more elements to the end of an array and returns the new length of the array.
139
+ /// The push() method adds one or more elements to the end of an array and returns
140
+ /// the new length of the array.
162
141
///
163
142
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
164
143
#[ wasm_bindgen( method) ]
165
144
pub fn push ( this : & Array , value : JsValue ) -> u32 ;
166
145
167
146
/// The reverse() method reverses an array in place.
168
147
/// The first array element becomes the last, and the last array element becomes the first.
169
- ///
148
+ ///
170
149
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
171
150
#[ wasm_bindgen( method) ]
172
151
pub fn reverse ( this : & Array ) -> Array ;
173
152
153
+ /// The slice() method returns a shallow copy of a portion of an array into a new array
154
+ /// object selected from begin to end (end not included).
155
+ /// The original array will not be modified.
156
+ ///
157
+ /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
158
+ #[ wasm_bindgen( method) ]
159
+ pub fn slice ( this : & Array , start : u32 , end : u32 ) -> Array ;
160
+
174
161
/// The shift() method removes the first element from an array and returns that removed element.
175
162
/// This method changes the length of the array.
176
163
///
177
164
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift
178
165
#[ wasm_bindgen( method) ]
179
166
pub fn shift ( this : & Array ) -> JsValue ;
180
167
181
- /// The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.
182
- ///
183
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift
168
+ /// The sort() method sorts the elements of an array in place and returns
169
+ /// the array. The sort is not necessarily stable. The default sort
170
+ /// order is according to string Unicode code points.
171
+ ///
172
+ /// The time and space complexity of the sort cannot be guaranteed as it
173
+ /// is implementation dependent.
174
+ ///
175
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
184
176
#[ wasm_bindgen( method) ]
185
- pub fn unshift ( this : & Array , value : JsValue ) -> u32 ;
177
+ pub fn sort ( this : & Array ) -> Array ;
186
178
187
179
/// The toString() method returns a string representing the specified array and its elements.
188
180
///
189
181
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
190
182
#[ wasm_bindgen( method, js_name = toString) ]
191
183
pub fn to_string ( this : & Array ) -> String ;
192
184
193
- /// The includes() method determines whether an array includes a certain element, returning true or false as appropriate.
185
+ /// The unshift() method adds one or more elements to the beginning of an array
186
+ /// and returns the new length of the array.
194
187
///
195
- /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
188
+ /// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift
196
189
#[ wasm_bindgen( method) ]
197
- pub fn includes ( this : & Array , value : JsValue , from_index : i32 ) -> bool ;
190
+ pub fn unshift ( this : & Array , value : JsValue ) -> u32 ;
198
191
}
199
192
200
193
// Array Iterator
@@ -213,4 +206,52 @@ extern {
213
206
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries
214
207
#[ wasm_bindgen( method) ]
215
208
pub fn entries ( this : & Array ) -> ArrayIterator ;
216
- }
209
+ }
210
+
211
+ // Object.
212
+ #[ wasm_bindgen]
213
+ extern {
214
+ pub type Object ;
215
+
216
+ /// The Object constructor creates an object wrapper.
217
+ ///
218
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
219
+ #[ wasm_bindgen( constructor) ]
220
+ pub fn new ( ) -> Object ;
221
+
222
+ /// The `hasOwnProperty()` method returns a boolean indicating whether the
223
+ /// object has the specified property as its own property (as opposed to
224
+ /// inheriting it).
225
+ ///
226
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
227
+ #[ wasm_bindgen( method, js_name = hasOwnProperty) ]
228
+ pub fn has_own_property ( this : & Object , property : & JsValue ) -> bool ;
229
+
230
+ /// The toLocaleString() method returns a string representing the object.
231
+ /// This method is meant to be overridden by derived objects for locale-specific
232
+ /// purposes.
233
+ ///
234
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString
235
+ #[ wasm_bindgen( method, js_name = toLocaleString) ]
236
+ pub fn to_locale_string ( this : & Object ) -> String ;
237
+
238
+ /// The toString() method returns a string representing the object.
239
+ ///
240
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
241
+ #[ wasm_bindgen( method, js_name = toString) ]
242
+ pub fn to_string ( this : & Object ) -> String ;
243
+
244
+ /// The isPrototypeOf() method checks if an object exists in another
245
+ /// object's prototype chain.
246
+ ///
247
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf
248
+ #[ wasm_bindgen( method, js_name = isPrototypeOf) ]
249
+ pub fn is_prototype_of ( this : & Object , value : & JsValue ) -> bool ;
250
+
251
+ /// The propertyIsEnumerable() method returns a Boolean indicating
252
+ /// whether the specified property is enumerable.
253
+ ///
254
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
255
+ #[ wasm_bindgen( method, js_name = propertyIsEnumerable) ]
256
+ pub fn property_is_enumerable ( this : & Object , property : & JsValue ) -> bool ;
257
+ }
0 commit comments