update array object
parent
90853f742d
commit
4b6cb4e86f
10
bridge.go
10
bridge.go
|
@ -116,8 +116,8 @@ func (b *Bridge) addValues() {
|
||||||
"Object": &object{name: "Object", new: func(args []interface{}) interface{} {
|
"Object": &object{name: "Object", new: func(args []interface{}) interface{} {
|
||||||
return &object{name: "ObjectInner", props: map[string]interface{}{}}
|
return &object{name: "ObjectInner", props: map[string]interface{}{}}
|
||||||
}},
|
}},
|
||||||
"Array": propObject("Array", nil),
|
"Array": arrayObject("Array"),
|
||||||
"Uint8Array": typedArray,
|
"Uint8Array": arrayObject("Uint8Array"),
|
||||||
"process": propObject("process", nil),
|
"process": propObject("process", nil),
|
||||||
"Date": &object{name: "Date", new: func(args []interface{}) interface{} {
|
"Date": &object{name: "Date", new: func(args []interface{}) interface{} {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
|
@ -432,8 +432,9 @@ type array struct {
|
||||||
buf []byte
|
buf []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
var typedArray = &object{
|
func arrayObject(name string) *object {
|
||||||
name: "TypedArray",
|
return &object{
|
||||||
|
name: name,
|
||||||
new: func(args []interface{}) interface{} {
|
new: func(args []interface{}) interface{} {
|
||||||
l := int(args[0].(float64))
|
l := int(args[0].(float64))
|
||||||
return &array{
|
return &array{
|
||||||
|
@ -441,6 +442,7 @@ var typedArray = &object{
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO make this a wrapper that takes an inner `this` js object
|
// TODO make this a wrapper that takes an inner `this` js object
|
||||||
type Func func(args []interface{}) (interface{}, error)
|
type Func func(args []interface{}) (interface{}, error)
|
||||||
|
|
Loading…
Reference in New Issue