Skip to content

Commit 99eb390

Browse files
authored
Implement JSValue for more structures
Previously was only implemented for PeerConnection.
1 parent 4ee3747 commit 99eb390

7 files changed

+35
-0
lines changed

Diff for: datachannel_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ type DataChannel struct {
3636
api *API
3737
}
3838

39+
// JSValue returns the underlying RTCDataChannel
40+
func (d *DataChannel) JSValue() js.Value {
41+
return d.underlying
42+
}
43+
3944
// OnOpen sets an event handler which is invoked when
4045
// the underlying data transport has been established (or re-established).
4146
func (d *DataChannel) OnOpen(f func()) {

Diff for: dtlstransport_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ type DTLSTransport struct {
1717
underlying js.Value
1818
}
1919

20+
// JSValue returns the underlying RTCDtlsTransport
21+
func (r *DTLSTransport) JSValue() js.Value {
22+
return r.underlying
23+
}
24+
2025
// ICETransport returns the currently-configured *ICETransport or nil
2126
// if one has not been configured
2227
func (r *DTLSTransport) ICETransport() *ICETransport {

Diff for: icetransport_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ type ICETransport struct {
1515
underlying js.Value
1616
}
1717

18+
// JSValue returns the underlying RTCIceTransport
19+
func (t *ICETransport) JSValue() js.Value {
20+
return t.underlying
21+
}
22+
1823
// GetSelectedCandidatePair returns the selected candidate pair on which packets are sent
1924
// if there is no selected pair nil is returned
2025
func (t *ICETransport) GetSelectedCandidatePair() (*ICECandidatePair, error) {

Diff for: rtpreceiver_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ type RTPReceiver struct {
1313
// Pointer to the underlying JavaScript RTCRTPReceiver object.
1414
underlying js.Value
1515
}
16+
17+
// JSValue returns the underlying RTCRtpReceiver
18+
func (r *RTPReceiver) JSValue() js.Value {
19+
return r.underlying
20+
}

Diff for: rtpsender_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ type RTPSender struct {
1313
// Pointer to the underlying JavaScript RTCRTPSender object.
1414
underlying js.Value
1515
}
16+
17+
// JSValue returns the underlying RTCRtpSender
18+
func (s *RTPSender) JSValue() js.Value {
19+
return s.underlying
20+
}

Diff for: rtptransceiver_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ type RTPTransceiver struct {
1616
underlying js.Value
1717
}
1818

19+
// JSValue returns the underlying RTCRtpTransceiver
20+
func (r *RTPTransceiver) JSValue() js.Value {
21+
return r.underlying
22+
}
23+
1924
// Direction returns the RTPTransceiver's current direction
2025
func (r *RTPTransceiver) Direction() RTPTransceiverDirection {
2126
return NewRTPTransceiverDirection(r.underlying.Get("direction").String())

Diff for: sctptransport_js.go

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ type SCTPTransport struct {
1414
underlying js.Value
1515
}
1616

17+
// JSValue returns the underlying RTCSctpTransport
18+
func (r *SCTPTransport) JSValue() js.Value {
19+
return r.underlying
20+
}
21+
1722
// Transport returns the DTLSTransport instance the SCTPTransport is sending over.
1823
func (r *SCTPTransport) Transport() *DTLSTransport {
1924
underlying := r.underlying.Get("transport")

0 commit comments

Comments
 (0)