Skip to content

Commit c042b7e

Browse files
authored
Merge pull request #796 from scala-js/compression
Add Compression APIs
2 parents 8c52373 + 1d2abf1 commit c042b7e

File tree

6 files changed

+81
-0
lines changed

6 files changed

+81
-0
lines changed

api-reports/2_12.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int]
13481348
CompositionEventInit[JT] var locale: js.UndefOr[String]
13491349
CompositionEventInit[JT] var scoped: js.UndefOr[Boolean]
13501350
CompositionEventInit[JT] var view: js.UndefOr[Window]
1351+
CompressionFormat[JT]
1352+
CompressionFormat[SO] val deflate: CompressionFormat
1353+
CompressionFormat[SO] val `deflate-raw`: CompressionFormat
1354+
CompressionFormat[SO] val gzip: CompressionFormat
1355+
CompressionStream[JC] def readable: ReadableStream[Uint8Array]
1356+
CompressionStream[JC] def writable: WriteableStream[Uint8Array]
13511357
ConcatParams[JT] val algorithmId: BufferSource
13521358
ConcatParams[JT] val hash: HashAlgorithmIdentifier
13531359
ConcatParams[JT] val name: String
@@ -1561,6 +1567,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D
15611567
DataTransferItemList[JC] def clear(): Unit
15621568
DataTransferItemList[JC] def length: Int
15631569
DataTransferItemList[JC] def remove(index: Int): Unit
1570+
DecompressionStream[JC] def readable: ReadableStream[Uint8Array]
1571+
DecompressionStream[JC] def writable: WriteableStream[Uint8Array]
15641572
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
15651573
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
15661574
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit

api-reports/2_13.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int]
13481348
CompositionEventInit[JT] var locale: js.UndefOr[String]
13491349
CompositionEventInit[JT] var scoped: js.UndefOr[Boolean]
13501350
CompositionEventInit[JT] var view: js.UndefOr[Window]
1351+
CompressionFormat[JT]
1352+
CompressionFormat[SO] val deflate: CompressionFormat
1353+
CompressionFormat[SO] val `deflate-raw`: CompressionFormat
1354+
CompressionFormat[SO] val gzip: CompressionFormat
1355+
CompressionStream[JC] def readable: ReadableStream[Uint8Array]
1356+
CompressionStream[JC] def writable: WriteableStream[Uint8Array]
13511357
ConcatParams[JT] val algorithmId: BufferSource
13521358
ConcatParams[JT] val hash: HashAlgorithmIdentifier
13531359
ConcatParams[JT] val name: String
@@ -1561,6 +1567,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D
15611567
DataTransferItemList[JC] def clear(): Unit
15621568
DataTransferItemList[JC] def length: Int
15631569
DataTransferItemList[JC] def remove(index: Int): Unit
1570+
DecompressionStream[JC] def readable: ReadableStream[Uint8Array]
1571+
DecompressionStream[JC] def writable: WriteableStream[Uint8Array]
15641572
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
15651573
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
15661574
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
@js.native
6+
sealed trait CompressionFormat extends js.Any
7+
8+
object CompressionFormat {
9+
val deflate: CompressionFormat = "deflate".asInstanceOf[CompressionFormat]
10+
11+
val `deflate-raw`: CompressionFormat = "deflate-raw".asInstanceOf[CompressionFormat]
12+
13+
val gzip: CompressionFormat = "gzip".asInstanceOf[CompressionFormat]
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
opaque type CompressionFormat <: String = String
6+
7+
object CompressionFormat {
8+
val deflate: CompressionFormat = "deflate"
9+
10+
val `deflate-raw`: CompressionFormat = "deflate-raw"
11+
12+
val gzip: CompressionFormat = "gzip"
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
2+
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
3+
* http://creativecommons.org/licenses/by-sa/2.5/
4+
*
5+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
6+
*/
7+
package org.scalajs.dom
8+
9+
import scala.scalajs.js
10+
import scala.scalajs.js.annotation._
11+
import scala.scalajs.js.typedarray.Uint8Array
12+
13+
/** An API for compressing a stream of data. */
14+
@js.native
15+
@JSGlobal
16+
class CompressionStream(format: CompressionFormat) extends js.Object {
17+
def readable: ReadableStream[Uint8Array] = js.native
18+
def writable: WriteableStream[Uint8Array] = js.native
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
2+
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
3+
* http://creativecommons.org/licenses/by-sa/2.5/
4+
*
5+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
6+
*/
7+
package org.scalajs.dom
8+
9+
import scala.scalajs.js
10+
import scala.scalajs.js.annotation._
11+
import scala.scalajs.js.typedarray.Uint8Array
12+
13+
/** An API for decompressing a stream of data. */
14+
@js.native
15+
@JSGlobal
16+
class DecompressionStream(format: CompressionFormat) extends js.Object {
17+
def readable: ReadableStream[Uint8Array] = js.native
18+
def writable: WriteableStream[Uint8Array] = js.native
19+
}

0 commit comments

Comments
 (0)