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:
Richard Musiol 2018-06-15 10:45:04 +02:00 committed by Brad Fitzpatrick
parent 6fdbed0543
commit 9c35c1a503
5 changed files with 27 additions and 0 deletions

View file

@ -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) {