Skip to content

Commit d2147a6

Browse files
authored
fix: js.Wrapper was removed in go1.19 (#20)
Fixes build against go1.19 js.Wrapper was removed: add it back as JSWrapper. golang/go#50310 golang/go@6c0daa7#diff-38b359833111770b96ea3bb8bc5e2b807e18bdbb80684a397ce63ff05e6d02ecL31 Signed-off-by: Christian Stewart <[email protected]>
1 parent 610a3a4 commit d2147a6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

indexeddb/idbblob/blob.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ func newBlob(buf js.Value) *Blob {
5959
return b
6060
}
6161

62+
// jsWrapper is implemented by types that are backed by a JavaScript value.
63+
type jsWrapper interface {
64+
// JSValue returns a JavaScript value associated with an object.
65+
JSValue() js.Value
66+
}
67+
6268
// FromBlob creates a Blob from the given blob.Blob, either wrapping the JS value or copying the bytes if incompatible.
6369
func FromBlob(b blob.Blob) *Blob {
64-
if b, ok := b.(js.Wrapper); ok {
70+
if b, ok := b.(jsWrapper); ok {
6571
return newBlob(b.JSValue())
6672
}
6773
buf := b.Bytes()
@@ -90,7 +96,7 @@ func (b *Blob) Bytes() []byte {
9096
return buf
9197
}
9298

93-
// JSValue implements js.Wrapper
99+
// JSValue implements JSWrapper
94100
func (b *Blob) JSValue() js.Value {
95101
return b.jsValue.Load().(js.Value)
96102
}

0 commit comments

Comments
 (0)