mirror of
https://github.com/golang/go.git
synced 2025-10-29 15:54:14 +00:00
syscall.js: add Value.InstanceOf
Change-Id: Icf56188fdb2b8ce6789830a35608203fdb9a3df6 Reviewed-on: https://go-review.googlesource.com/120560 Reviewed-by: Paul Jolly <paul@myitcv.org.uk> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6fdbed0543
commit
9c35c1a503
5 changed files with 27 additions and 0 deletions
|
|
@ -146,6 +146,16 @@ func TestNew(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestInstanceOf(t *testing.T) {
|
||||
someArray := js.Global.Get("Array").New()
|
||||
if got, want := someArray.InstanceOf(js.Global.Get("Array")), true; got != want {
|
||||
t.Errorf("got %#v, want %#v", got, want)
|
||||
}
|
||||
if got, want := someArray.InstanceOf(js.Global.Get("Function")), false; got != want {
|
||||
t.Errorf("got %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCallback(t *testing.T) {
|
||||
c := make(chan struct{})
|
||||
cb := js.NewCallback(func(args []js.Value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue