@@ -116,8 +116,8 @@ func (b *Bridge) addValues() {
116
116
"Object" : & object {name : "Object" , new : func (args []interface {}) interface {} {
117
117
return & object {name : "ObjectInner" , props : map [string ]interface {}{}}
118
118
}},
119
- "Array" : propObject ("Array" , nil ),
120
- "Uint8Array" : typedArray ,
119
+ "Array" : arrayObject ("Array" ),
120
+ "Uint8Array" : arrayObject ( "Uint8Array" ) ,
121
121
"process" : propObject ("process" , nil ),
122
122
"Date" : & object {name : "Date" , new : func (args []interface {}) interface {} {
123
123
t := time .Now ()
@@ -432,14 +432,16 @@ type array struct {
432
432
buf []byte
433
433
}
434
434
435
- var typedArray = & object {
436
- name : "TypedArray" ,
437
- new : func (args []interface {}) interface {} {
438
- l := int (args [0 ].(float64 ))
439
- return & array {
440
- buf : make ([]byte , l , l ),
441
- }
442
- },
435
+ func arrayObject (name string ) * object {
436
+ return & object {
437
+ name : name ,
438
+ new : func (args []interface {}) interface {} {
439
+ l := int (args [0 ].(float64 ))
440
+ return & array {
441
+ buf : make ([]byte , l , l ),
442
+ }
443
+ },
444
+ }
443
445
}
444
446
445
447
// TODO make this a wrapper that takes an inner `this` js object
0 commit comments