Skip to content

Commit 52ebfcc

Browse files
FabioPinheirosjrd
authored andcommitted
Fix #346: Give the correct type to PushSubscription.toJSON (#347)
1 parent c85473e commit 52ebfcc

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

src/main/scala/org/scalajs/dom/experimental/push/PushManager.scala

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import scala.scalajs.js.typedarray.{ArrayBuffer, Uint8Array}
1414
*
1515
* MDN
1616
*
17-
* The Push API is currently specified here: [[http://www.w3.org/TR/2015/WD-push-api-20151215/]]
17+
* The Push API is currently specified here: [[https://www.w3.org/TR/2018/WD-push-api-20181026/]]
1818
*/
1919
@js.native
2020
trait PushManager extends js.Object {
@@ -79,6 +79,23 @@ trait PushSubscription extends js.Object {
7979
*/
8080
val endpoint: String = js.native
8181

82+
/**
83+
* The expirationTime read-only property of the PushSubscription interface returns a
84+
* DOMHighResTimeStamp of the subscription expiration time associated with the push
85+
* subscription, if there is one, or null otherwise.
86+
*
87+
* MDN
88+
*/
89+
val expirationTime: java.lang.Double = js.native
90+
91+
/**
92+
* The options read-only property of the PushSubscription interface is an object containing
93+
* containing the options used to create the subscription.
94+
*
95+
* MDN
96+
*/
97+
val options: PushSubscriptionOptions = js.native
98+
8299
/**
83100
* The getKey method retrieves keying material that can be used for encrypting and authenticating messages.
84101
*/
@@ -98,7 +115,39 @@ trait PushSubscription extends js.Object {
98115
*
99116
* MDN
100117
*/
101-
def toJSON(): String = js.native
118+
def toJSON(): PushSubscriptionJSON = js.native
119+
}
120+
121+
/**
122+
* A PushSubscriptionJSON dictionary represents the JSON type of a PushSubscription. In ECMAScript this can
123+
* be converted into a JSON string through the JSON.stringify function.
124+
*
125+
* MDN
126+
*/
127+
@js.native
128+
trait PushSubscriptionJSON extends js.Object {
129+
130+
/**
131+
* The endpoint contains the underlying value of the endpoint attribute.
132+
*
133+
* MDN
134+
*/
135+
val endpoint: String = js.native
136+
137+
/**
138+
* The endpoint contains the underlying value of the endpoint attribute.
139+
*
140+
* MDN
141+
*/
142+
val expirationTime: java.lang.Double = js.native
143+
144+
/**
145+
* The keys record contains an entry for each of the supported PushEncryptionKeyName entries to the URL-safe
146+
* base64 encoded representation [RFC4648] of its value.
147+
*
148+
* MDN
149+
*/
150+
val keys: js.Dictionary[String] = js.native
102151
}
103152

104153
/**

0 commit comments

Comments
 (0)