Skip to content

Commit 7a1adfa

Browse files
authored
Merge pull request #2 from tamer316/patch-2
Add companion object for AlertButton
2 parents f660d4a + f2a6a31 commit 7a1adfa

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/scala/sri/universal/apis/Alert.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package sri.universal.apis
33
import scala.scalajs.js
44
import scala.scalajs.js.Dynamic.{literal => json}
55
import scala.scalajs.js.annotation.JSImport
6+
import sri.macros.{FunctionObjectMacro, OptDefault => NoValue, OptionalParam => OP}
67

78
@js.native
89
trait Alert extends js.Object {
@@ -18,9 +19,19 @@ trait Alert extends js.Object {
1819
object Alert extends Alert
1920

2021
trait AlertButton extends js.Object {
21-
var text: js.UndefOr[String] = js.undefined
22-
var onPress: js.UndefOr[js.Function] = js.undefined
23-
var style: js.UndefOr[AlertButtonStyle] = js.undefined
22+
val text: js.UndefOr[String] = js.undefined
23+
val onPress: js.UndefOr[js.Function] = js.undefined
24+
val style: js.UndefOr[AlertButtonStyle] = js.undefined
25+
}
26+
27+
object AlertButton {
28+
@inline
29+
def apply(text: OP[String] = NoValue,
30+
onPress: OP[() => _] = NoValue,
31+
style: OP[AlertButtonStyle] = NoValue): AlertButton = {
32+
val p = FunctionObjectMacro()
33+
p.asInstanceOf[AlertButton]
34+
}
2435
}
2536

2637
trait AlertOptions extends js.Object {

0 commit comments

Comments
 (0)