File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,15 @@ func newBlob(buf js.Value) *Blob {
59
59
return b
60
60
}
61
61
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
+
62
68
// FromBlob creates a Blob from the given blob.Blob, either wrapping the JS value or copying the bytes if incompatible.
63
69
func FromBlob (b blob.Blob ) * Blob {
64
- if b , ok := b .(js. Wrapper ); ok {
70
+ if b , ok := b .(jsWrapper ); ok {
65
71
return newBlob (b .JSValue ())
66
72
}
67
73
buf := b .Bytes ()
@@ -90,7 +96,7 @@ func (b *Blob) Bytes() []byte {
90
96
return buf
91
97
}
92
98
93
- // JSValue implements js.Wrapper
99
+ // JSValue implements JSWrapper
94
100
func (b * Blob ) JSValue () js.Value {
95
101
return b .jsValue .Load ().(js.Value )
96
102
}
You can’t perform that action at this time.
0 commit comments