Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Compression APIs #796

Merged
merged 2 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int]
CompositionEventInit[JT] var locale: js.UndefOr[String]
CompositionEventInit[JT] var scoped: js.UndefOr[Boolean]
CompositionEventInit[JT] var view: js.UndefOr[Window]
CompressionFormat[JT]
CompressionFormat[SO] val deflate: CompressionFormat
CompressionFormat[SO] val `deflate-raw`: CompressionFormat
CompressionFormat[SO] val gzip: CompressionFormat
CompressionStream[JC] def readable: ReadableStream[Uint8Array]
CompressionStream[JC] def writable: WriteableStream[Uint8Array]
ConcatParams[JT] val algorithmId: BufferSource
ConcatParams[JT] val hash: HashAlgorithmIdentifier
ConcatParams[JT] val name: String
Expand Down Expand Up @@ -1561,6 +1567,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D
DataTransferItemList[JC] def clear(): Unit
DataTransferItemList[JC] def length: Int
DataTransferItemList[JC] def remove(index: Int): Unit
DecompressionStream[JC] def readable: ReadableStream[Uint8Array]
DecompressionStream[JC] def writable: WriteableStream[Uint8Array]
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
Expand Down
8 changes: 8 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int]
CompositionEventInit[JT] var locale: js.UndefOr[String]
CompositionEventInit[JT] var scoped: js.UndefOr[Boolean]
CompositionEventInit[JT] var view: js.UndefOr[Window]
CompressionFormat[JT]
CompressionFormat[SO] val deflate: CompressionFormat
CompressionFormat[SO] val `deflate-raw`: CompressionFormat
CompressionFormat[SO] val gzip: CompressionFormat
CompressionStream[JC] def readable: ReadableStream[Uint8Array]
CompressionStream[JC] def writable: WriteableStream[Uint8Array]
ConcatParams[JT] val algorithmId: BufferSource
ConcatParams[JT] val hash: HashAlgorithmIdentifier
ConcatParams[JT] val name: String
Expand Down Expand Up @@ -1561,6 +1567,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D
DataTransferItemList[JC] def clear(): Unit
DataTransferItemList[JC] def length: Int
DataTransferItemList[JC] def remove(index: Int): Unit
DecompressionStream[JC] def readable: ReadableStream[Uint8Array]
DecompressionStream[JC] def writable: WriteableStream[Uint8Array]
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
Expand Down
14 changes: 14 additions & 0 deletions dom/src/main/scala-2/org/scalajs/dom/CompressionFormat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.scalajs.dom

import scala.scalajs.js

@js.native
sealed trait CompressionFormat extends js.Any

object CompressionFormat {
val deflate: CompressionFormat = "deflate".asInstanceOf[CompressionFormat]

val `deflate-raw`: CompressionFormat = "deflate-raw".asInstanceOf[CompressionFormat]

val gzip: CompressionFormat = "gzip".asInstanceOf[CompressionFormat]
}
13 changes: 13 additions & 0 deletions dom/src/main/scala-3/org/scalajs/dom/CompressionFormat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.scalajs.dom

import scala.scalajs.js

opaque type CompressionFormat <: String = String

object CompressionFormat {
val deflate: CompressionFormat = "deflate"

val `deflate-raw`: CompressionFormat = "deflate-raw"

val gzip: CompressionFormat = "gzip"
}
19 changes: 19 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/CompressionStream.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
* http://creativecommons.org/licenses/by-sa/2.5/
*
* Everything else is under the MIT License http://opensource.org/licenses/MIT
*/
package org.scalajs.dom

import scala.scalajs.js
import scala.scalajs.js.annotation._
import scala.scalajs.js.typedarray.Uint8Array

/** An API for compressing a stream of data. */
@js.native
@JSGlobal
class CompressionStream(format: CompressionFormat) extends js.Object {
def readable: ReadableStream[Uint8Array] = js.native
def writable: WriteableStream[Uint8Array] = js.native
}
19 changes: 19 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/DecompressionStream.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
* http://creativecommons.org/licenses/by-sa/2.5/
*
* Everything else is under the MIT License http://opensource.org/licenses/MIT
*/
package org.scalajs.dom

import scala.scalajs.js
import scala.scalajs.js.annotation._
import scala.scalajs.js.typedarray.Uint8Array

/** An API for decompressing a stream of data. */
@js.native
@JSGlobal
class DecompressionStream(format: CompressionFormat) extends js.Object {
def readable: ReadableStream[Uint8Array] = js.native
def writable: WriteableStream[Uint8Array] = js.native
}