summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/webrtc/v3/api_js.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pion/webrtc/v3/api_js.go')
-rw-r--r--vendor/github.com/pion/webrtc/v3/api_js.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/github.com/pion/webrtc/v3/api_js.go b/vendor/github.com/pion/webrtc/v3/api_js.go
new file mode 100644
index 0000000..964b7b0
--- /dev/null
+++ b/vendor/github.com/pion/webrtc/v3/api_js.go
@@ -0,0 +1,31 @@
+// +build js,wasm
+
+package webrtc
+
+// API bundles the global funcions of the WebRTC and ORTC API.
+type API struct {
+ settingEngine *SettingEngine
+}
+
+// NewAPI Creates a new API object for keeping semi-global settings to WebRTC objects
+func NewAPI(options ...func(*API)) *API {
+ a := &API{}
+
+ for _, o := range options {
+ o(a)
+ }
+
+ if a.settingEngine == nil {
+ a.settingEngine = &SettingEngine{}
+ }
+
+ return a
+}
+
+// WithSettingEngine allows providing a SettingEngine to the API.
+// Settings should not be changed after passing the engine to an API.
+func WithSettingEngine(s SettingEngine) func(a *API) {
+ return func(a *API) {
+ a.settingEngine = &s
+ }
+}