Skip to content

Commit 2aaf2ed

Browse files
committed
Switch back to using traits for now.
1 parent b44eaa8 commit 2aaf2ed

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

dom/src/main/scala/org/scalajs/dom/GainNode.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package org.scalajs.dom
77

88
import scala.scalajs.js
9-
import scala.scalajs.js.annotation._
109

1110
/** The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given
1211
* gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input
@@ -24,10 +23,15 @@ import scala.scalajs.js.annotation._
2423
* - Channel count: 2 (not used in the default count mode)
2524
* - Channel interpretation: "speakers"
2625
*/
27-
@JSGlobal
2826
@js.native
29-
class GainNode(context: BaseAudioContext, options: GainNodeOptions = js.native) extends AudioNode {
27+
trait GainNode extends AudioNode {
3028

3129
/** Is an a-rate AudioParam representing the amount of gain to apply. */
3230
val gain: AudioParam = js.native
3331
}
32+
33+
object GainNode {
34+
35+
def apply(context: BaseAudioContext, options: js.UndefOr[GainNodeOptions] = js.undefined): GainNode =
36+
js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode]
37+
}

dom/src/main/scala/org/scalajs/dom/OscillatorNode.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package org.scalajs.dom
77

88
import scala.scalajs.js
9-
import scala.scalajs.js.annotation._
109

1110
/** The OscillatorNode interface represents a periodic waveform, like a sine wave. It is an AudioNode audio-processing
1211
* module that causes a given frequency of sine wave to be created — in effect, a constant tone.
@@ -20,9 +19,8 @@ import scala.scalajs.js.annotation._
2019
* - Channel count: 2 (not used in the default count mode)
2120
* - Channel interpretation: speakers
2221
*/
23-
@JSGlobal
2422
@js.native
25-
class OscillatorNode(context: BaseAudioContext, options: OscillatorNodeOptions = js.native)
23+
trait OscillatorNode
2624
extends AudioScheduledSourceNode {
2725

2826
/** An a-rate AudioParam representing the frequency of oscillation in hertz (though the AudioParam returned is
@@ -45,3 +43,8 @@ class OscillatorNode(context: BaseAudioContext, options: OscillatorNodeOptions =
4543
*/
4644
def setPeriodicWave(wave: PeriodicWave): Unit = js.native
4745
}
46+
47+
object OscillatorNode {
48+
def apply(context: BaseAudioContext, options: js.UndefOr[OscillatorNodeOptions] = js.undefined): GainNode =
49+
js.Dynamic.newInstance(js.Dynamic.global.GainNode)(context, options).asInstanceOf[GainNode]
50+
}

0 commit comments

Comments
 (0)