From 6d6a3cdb2655427c7e31dc2190dabea99f216a94 Mon Sep 17 00:00:00 2001 From: Carlos Quiroz <3615303+cquiroz@users.noreply.github.com> Date: Mon, 4 Jul 2022 17:36:40 -0400 Subject: [PATCH 01/13] Improvements to the Performance API --- dom/src/main/scala/org/scalajs/dom/Performance.scala | 8 ++++---- dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/Performance.scala b/dom/src/main/scala/org/scalajs/dom/Performance.scala index 5a5a00dd4..63931105e 100644 --- a/dom/src/main/scala/org/scalajs/dom/Performance.scala +++ b/dom/src/main/scala/org/scalajs/dom/Performance.scala @@ -15,7 +15,7 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class Performance extends js.Object { +class Performance private[this]() extends js.Object { /** The Performance.navigation read-only property returns a PerformanceNavigation object representing the type of * navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the @@ -28,7 +28,7 @@ class Performance extends js.Object { */ def timing: PerformanceTiming = js.native - def getEntriesByType(entryType: String): js.Dynamic = js.native + def getEntriesByType(entryType: String): js.Array[PerformanceEntry] = js.native /** Is a jsonizer returning a json object representing the Performance object. */ def toJSON(): js.Dynamic = js.native @@ -45,9 +45,9 @@ class Performance extends js.Object { def measure(measureName: String, startMarkName: String = js.native, endMarkName: String = js.native): Unit = js.native - def getEntriesByName(name: String, entryType: String = js.native): js.Dynamic = js.native + def getEntriesByName(name: String, entryType: String = js.native): js.Array[PerformanceEntry] = js.native - def getEntries(): js.Dynamic = js.native + def getEntries(): js.Array[PerformanceEntry] = js.native def clearMeasures(measureName: String = js.native): Unit = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala index 781238c55..3754758cb 100644 --- a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala +++ b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala @@ -16,7 +16,7 @@ class PerformanceEntry extends js.Object { def startTime: Double = js.native - def duration: Int = js.native + def duration: Double = js.native def entryType: String = js.native } From 38b89883f10f2fe689973a1047ba4bb9e6720746 Mon Sep 17 00:00:00 2001 From: Carlos Quiroz <3615303+cquiroz@users.noreply.github.com> Date: Mon, 4 Jul 2022 17:40:39 -0400 Subject: [PATCH 02/13] run prePR --- api-reports/2_12.txt | 14 +++++++------- api-reports/2_13.txt | 14 +++++++------- .../main/scala/org/scalajs/dom/Performance.scala | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index f16a5a82e..b9a63f313 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15763,9 +15763,9 @@ Pbkdf2Params[SO] val salt = salt0 Performance[JC] def clearMarks(markName: String?): Unit Performance[JC] def clearMeasures(measureName: String?): Unit Performance[JC] def clearResourceTimings(): Unit -Performance[JC] def getEntries(): js.Dynamic -Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Dynamic -Performance[JC] def getEntriesByType(entryType: String): js.Dynamic +Performance[JC] def getEntries(): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] Performance[JC] def getMarks(markName: String?): js.Dynamic Performance[JC] def getMeasures(measureName: String?): js.Dynamic Performance[JC] def mark(markName: String): Unit @@ -15775,15 +15775,15 @@ Performance[JC] def now(): Double Performance[JC] def setResourceTimingBufferSize(maxSize: Int): Unit Performance[JC] def timing: PerformanceTiming Performance[JC] def toJSON(): js.Dynamic -PerformanceEntry[JC] def duration: Int +PerformanceEntry[JC] def duration: Double PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String PerformanceEntry[JC] def startTime: Double -PerformanceMark[JC] def duration: Int +PerformanceMark[JC] def duration: Double PerformanceMark[JC] def entryType: String PerformanceMark[JC] def name: String PerformanceMark[JC] def startTime: Double -PerformanceMeasure[JC] def duration: Int +PerformanceMeasure[JC] def duration: Double PerformanceMeasure[JC] def entryType: String PerformanceMeasure[JC] def name: String PerformanceMeasure[JC] def startTime: Double @@ -15798,7 +15798,7 @@ PerformanceResourceTiming[JC] def connectEnd: Int PerformanceResourceTiming[JC] def connectStart: Int PerformanceResourceTiming[JC] def domainLookupEnd: Int PerformanceResourceTiming[JC] def domainLookupStart: Int -PerformanceResourceTiming[JC] def duration: Int +PerformanceResourceTiming[JC] def duration: Double PerformanceResourceTiming[JC] def entryType: String PerformanceResourceTiming[JC] def fetchStart: Int PerformanceResourceTiming[JC] def initiatorType: String diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index f16a5a82e..b9a63f313 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15763,9 +15763,9 @@ Pbkdf2Params[SO] val salt = salt0 Performance[JC] def clearMarks(markName: String?): Unit Performance[JC] def clearMeasures(measureName: String?): Unit Performance[JC] def clearResourceTimings(): Unit -Performance[JC] def getEntries(): js.Dynamic -Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Dynamic -Performance[JC] def getEntriesByType(entryType: String): js.Dynamic +Performance[JC] def getEntries(): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] Performance[JC] def getMarks(markName: String?): js.Dynamic Performance[JC] def getMeasures(measureName: String?): js.Dynamic Performance[JC] def mark(markName: String): Unit @@ -15775,15 +15775,15 @@ Performance[JC] def now(): Double Performance[JC] def setResourceTimingBufferSize(maxSize: Int): Unit Performance[JC] def timing: PerformanceTiming Performance[JC] def toJSON(): js.Dynamic -PerformanceEntry[JC] def duration: Int +PerformanceEntry[JC] def duration: Double PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String PerformanceEntry[JC] def startTime: Double -PerformanceMark[JC] def duration: Int +PerformanceMark[JC] def duration: Double PerformanceMark[JC] def entryType: String PerformanceMark[JC] def name: String PerformanceMark[JC] def startTime: Double -PerformanceMeasure[JC] def duration: Int +PerformanceMeasure[JC] def duration: Double PerformanceMeasure[JC] def entryType: String PerformanceMeasure[JC] def name: String PerformanceMeasure[JC] def startTime: Double @@ -15798,7 +15798,7 @@ PerformanceResourceTiming[JC] def connectEnd: Int PerformanceResourceTiming[JC] def connectStart: Int PerformanceResourceTiming[JC] def domainLookupEnd: Int PerformanceResourceTiming[JC] def domainLookupStart: Int -PerformanceResourceTiming[JC] def duration: Int +PerformanceResourceTiming[JC] def duration: Double PerformanceResourceTiming[JC] def entryType: String PerformanceResourceTiming[JC] def fetchStart: Int PerformanceResourceTiming[JC] def initiatorType: String diff --git a/dom/src/main/scala/org/scalajs/dom/Performance.scala b/dom/src/main/scala/org/scalajs/dom/Performance.scala index 63931105e..b1bf3d76e 100644 --- a/dom/src/main/scala/org/scalajs/dom/Performance.scala +++ b/dom/src/main/scala/org/scalajs/dom/Performance.scala @@ -15,7 +15,7 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class Performance private[this]() extends js.Object { +class Performance private[this] () extends js.Object { /** The Performance.navigation read-only property returns a PerformanceNavigation object representing the type of * navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the From cbc769fcd6d0702a3d1e5f1837cba161218293f5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 9 Feb 2023 17:29:55 +0000 Subject: [PATCH 03/13] Back to `Int` for `duration` --- api-reports/2_13.txt | 8 ++++---- dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index b9a63f313..36d85dd86 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15775,15 +15775,15 @@ Performance[JC] def now(): Double Performance[JC] def setResourceTimingBufferSize(maxSize: Int): Unit Performance[JC] def timing: PerformanceTiming Performance[JC] def toJSON(): js.Dynamic -PerformanceEntry[JC] def duration: Double +PerformanceEntry[JC] def duration: Int PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String PerformanceEntry[JC] def startTime: Double -PerformanceMark[JC] def duration: Double +PerformanceMark[JC] def duration: Int PerformanceMark[JC] def entryType: String PerformanceMark[JC] def name: String PerformanceMark[JC] def startTime: Double -PerformanceMeasure[JC] def duration: Double +PerformanceMeasure[JC] def duration: Int PerformanceMeasure[JC] def entryType: String PerformanceMeasure[JC] def name: String PerformanceMeasure[JC] def startTime: Double @@ -15798,7 +15798,7 @@ PerformanceResourceTiming[JC] def connectEnd: Int PerformanceResourceTiming[JC] def connectStart: Int PerformanceResourceTiming[JC] def domainLookupEnd: Int PerformanceResourceTiming[JC] def domainLookupStart: Int -PerformanceResourceTiming[JC] def duration: Double +PerformanceResourceTiming[JC] def duration: Int PerformanceResourceTiming[JC] def entryType: String PerformanceResourceTiming[JC] def fetchStart: Int PerformanceResourceTiming[JC] def initiatorType: String diff --git a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala index 3754758cb..781238c55 100644 --- a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala +++ b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala @@ -16,7 +16,7 @@ class PerformanceEntry extends js.Object { def startTime: Double = js.native - def duration: Double = js.native + def duration: Int = js.native def entryType: String = js.native } From 1ee7b405763affc9d50e025560b68b5640facfbf Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 9 Feb 2023 17:33:16 +0000 Subject: [PATCH 04/13] Add some docs --- .../scala/org/scalajs/dom/PerformanceEntry.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala index 781238c55..cdc487b6f 100644 --- a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala +++ b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala @@ -9,14 +9,26 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ +/** Encapsulates a single performance metric that is part of the browser's performance timeline. */ @js.native @JSGlobal class PerformanceEntry extends js.Object { + + /** The name for a performance entry. It acts as an identifier, but it does not have to be unique. The value depends + * on the subclass. + */ def name: String = js.native + /** The first timestamp recorded for this performance entry. The meaning of this property depends on the value of this + * entry's [[entryType]]. + */ def startTime: Double = js.native + /** The duration of the performance entry. The meaning of this property depends on the value of this entry's + * [[entryType]]. + */ def duration: Int = js.native + /** The type of performance metric that this entry represents. */ def entryType: String = js.native } From 12deff1ee452dee85aba35f8ee5535bfb61f0558 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 9 Feb 2023 17:36:24 +0000 Subject: [PATCH 05/13] Add `toJSON()` --- api-reports/2_13.txt | 4 ++++ dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala | 3 +++ 2 files changed, 7 insertions(+) diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 36d85dd86..9f079c90c 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15779,14 +15779,17 @@ PerformanceEntry[JC] def duration: Int PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String PerformanceEntry[JC] def startTime: Double +PerformanceEntry[JC] def toJSON(): js.Object PerformanceMark[JC] def duration: Int PerformanceMark[JC] def entryType: String PerformanceMark[JC] def name: String PerformanceMark[JC] def startTime: Double +PerformanceMark[JC] def toJSON(): js.Object PerformanceMeasure[JC] def duration: Int PerformanceMeasure[JC] def entryType: String PerformanceMeasure[JC] def name: String PerformanceMeasure[JC] def startTime: Double +PerformanceMeasure[JC] def toJSON(): js.Object PerformanceNavigation[JC] def redirectCount: Int PerformanceNavigation[JC] def toJSON(): js.Dynamic PerformanceNavigation[JC] def `type`: Int @@ -15809,6 +15812,7 @@ PerformanceResourceTiming[JC] def requestStart: Int PerformanceResourceTiming[JC] var responseEnd: Int PerformanceResourceTiming[JC] def responseStart: Int PerformanceResourceTiming[JC] def startTime: Double +PerformanceResourceTiming[JC] def toJSON(): js.Object PerformanceTiming[JC] def connectEnd: Double PerformanceTiming[JC] def connectStart: Double PerformanceTiming[JC] def domComplete: Double diff --git a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala index cdc487b6f..3511259ee 100644 --- a/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala +++ b/dom/src/main/scala/org/scalajs/dom/PerformanceEntry.scala @@ -31,4 +31,7 @@ class PerformanceEntry extends js.Object { /** The type of performance metric that this entry represents. */ def entryType: String = js.native + + /** Returns a JSON representation of the [[PerformanceEntry]] object. */ + def toJSON(): js.Object = js.native } From 1066217097e45f2686c6c5fd7458b55956cacddd Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 9 Feb 2023 19:01:40 +0000 Subject: [PATCH 06/13] Refresh `Performance` --- api-reports/2_13.txt | 12 ++++---- .../scala/org/scalajs/dom/Performance.scala | 28 ++++++++++++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 9f079c90c..7c307825a 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15764,17 +15764,17 @@ Performance[JC] def clearMarks(markName: String?): Unit Performance[JC] def clearMeasures(measureName: String?): Unit Performance[JC] def clearResourceTimings(): Unit Performance[JC] def getEntries(): js.Array[PerformanceEntry] -Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByName(name: String, `type`: String?): js.Array[PerformanceEntry] Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] -Performance[JC] def getMarks(markName: String?): js.Dynamic -Performance[JC] def getMeasures(measureName: String?): js.Dynamic -Performance[JC] def mark(markName: String): Unit -Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): Unit +Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def mark(markName: String): PerformanceMark +Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): PerformanceMeasure Performance[JC] def navigation: PerformanceNavigation Performance[JC] def now(): Double Performance[JC] def setResourceTimingBufferSize(maxSize: Int): Unit Performance[JC] def timing: PerformanceTiming -Performance[JC] def toJSON(): js.Dynamic +Performance[JC] def toJSON(): js.Object PerformanceEntry[JC] def duration: Int PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String diff --git a/dom/src/main/scala/org/scalajs/dom/Performance.scala b/dom/src/main/scala/org/scalajs/dom/Performance.scala index b1bf3d76e..04731c8b0 100644 --- a/dom/src/main/scala/org/scalajs/dom/Performance.scala +++ b/dom/src/main/scala/org/scalajs/dom/Performance.scala @@ -28,29 +28,49 @@ class Performance private[this] () extends js.Object { */ def timing: PerformanceTiming = js.native + /** Returns an array of [[PerformanceEntry]] objects currently present in the performance timeline for a given type */ def getEntriesByType(entryType: String): js.Array[PerformanceEntry] = js.native /** Is a jsonizer returning a json object representing the Performance object. */ - def toJSON(): js.Dynamic = js.native + def toJSON(): js.Object = js.native + @deprecated("No such API in the spec", "2.4.0") def getMeasures(measureName: String = js.native): js.Dynamic = js.native + /** Removes all or specific [[PerformanceMark]] objects from the browser's performance timeline. */ def clearMarks(markName: String = js.native): Unit = js.native + @deprecated("No such API in the spec", "2.4.0") def getMarks(markName: String = js.native): js.Dynamic = js.native + /** Removes all performance entries with an `entryType` of "resource" from the browser's performance timeline and sets + * the size of the performance resource data buffer to zero. + */ def clearResourceTimings(): Unit = js.native - def mark(markName: String): Unit = js.native + /** Creates a named [[PerformanceMark]] object representing a high resolution timestamp marker in the browser's + * performance timeline. + */ + def mark(markName: String): PerformanceMark = js.native - def measure(measureName: String, startMarkName: String = js.native, endMarkName: String = js.native): Unit = js.native + /** Creates a named [[PerformanceMeasure]] object representing a time measurement between two marks in the browser's + * performance timeline. + */ + def measure(measureName: String, startMarkName: String = js.native, + endMarkName: String = js.native): PerformanceMeasure = js.native - def getEntriesByName(name: String, entryType: String = js.native): js.Array[PerformanceEntry] = js.native + /** Returns an array of [[PerformanceEntry]] objects currently present in the performance timeline with the given name + * and type. + */ + def getEntriesByName(name: String, `type`: String = js.native): js.Array[PerformanceEntry] = js.native + /** All [[PerformanceEntry]] objects currently present in the performance timeline. */ def getEntries(): js.Array[PerformanceEntry] = js.native + /** Removes all or specific [[PerformanceMeasure]] objects from the browser's performance timeline. */ def clearMeasures(measureName: String = js.native): Unit = js.native + /** sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries. */ def setResourceTimingBufferSize(maxSize: Int): Unit = js.native /** Returns a DOMHighResTimeStamp representing the amount of milliseconds elapsed since the start of the navigation, From 12eea31da1d6941bc5a26ebb152b2e0434857703 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 9 Feb 2023 19:03:21 +0000 Subject: [PATCH 07/13] API reports on 2.12 --- api-reports/2_12.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index b9a63f313..7c307825a 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15764,29 +15764,32 @@ Performance[JC] def clearMarks(markName: String?): Unit Performance[JC] def clearMeasures(measureName: String?): Unit Performance[JC] def clearResourceTimings(): Unit Performance[JC] def getEntries(): js.Array[PerformanceEntry] -Performance[JC] def getEntriesByName(name: String, entryType: String?): js.Array[PerformanceEntry] +Performance[JC] def getEntriesByName(name: String, `type`: String?): js.Array[PerformanceEntry] Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] -Performance[JC] def getMarks(markName: String?): js.Dynamic -Performance[JC] def getMeasures(measureName: String?): js.Dynamic -Performance[JC] def mark(markName: String): Unit -Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): Unit +Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def mark(markName: String): PerformanceMark +Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): PerformanceMeasure Performance[JC] def navigation: PerformanceNavigation Performance[JC] def now(): Double Performance[JC] def setResourceTimingBufferSize(maxSize: Int): Unit Performance[JC] def timing: PerformanceTiming -Performance[JC] def toJSON(): js.Dynamic -PerformanceEntry[JC] def duration: Double +Performance[JC] def toJSON(): js.Object +PerformanceEntry[JC] def duration: Int PerformanceEntry[JC] def entryType: String PerformanceEntry[JC] def name: String PerformanceEntry[JC] def startTime: Double -PerformanceMark[JC] def duration: Double +PerformanceEntry[JC] def toJSON(): js.Object +PerformanceMark[JC] def duration: Int PerformanceMark[JC] def entryType: String PerformanceMark[JC] def name: String PerformanceMark[JC] def startTime: Double -PerformanceMeasure[JC] def duration: Double +PerformanceMark[JC] def toJSON(): js.Object +PerformanceMeasure[JC] def duration: Int PerformanceMeasure[JC] def entryType: String PerformanceMeasure[JC] def name: String PerformanceMeasure[JC] def startTime: Double +PerformanceMeasure[JC] def toJSON(): js.Object PerformanceNavigation[JC] def redirectCount: Int PerformanceNavigation[JC] def toJSON(): js.Dynamic PerformanceNavigation[JC] def `type`: Int @@ -15798,7 +15801,7 @@ PerformanceResourceTiming[JC] def connectEnd: Int PerformanceResourceTiming[JC] def connectStart: Int PerformanceResourceTiming[JC] def domainLookupEnd: Int PerformanceResourceTiming[JC] def domainLookupStart: Int -PerformanceResourceTiming[JC] def duration: Double +PerformanceResourceTiming[JC] def duration: Int PerformanceResourceTiming[JC] def entryType: String PerformanceResourceTiming[JC] def fetchStart: Int PerformanceResourceTiming[JC] def initiatorType: String @@ -15809,6 +15812,7 @@ PerformanceResourceTiming[JC] def requestStart: Int PerformanceResourceTiming[JC] var responseEnd: Int PerformanceResourceTiming[JC] def responseStart: Int PerformanceResourceTiming[JC] def startTime: Double +PerformanceResourceTiming[JC] def toJSON(): js.Object PerformanceTiming[JC] def connectEnd: Double PerformanceTiming[JC] def connectStart: Double PerformanceTiming[JC] def domComplete: Double From 1f4b7377b2b726b751d0887d52c8d29dcb7c0a91 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 22 Sep 2023 14:33:00 -0700 Subject: [PATCH 08/13] Revert "Update sbt to 1.9.6" --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 27430827b..304098715 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.6 +sbt.version=1.9.4 From 4f5fd1e0a1257277ccf968b9b443b3940881e044 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 22 Sep 2023 22:38:28 +0000 Subject: [PATCH 09/13] Add `BroadcastChannel` --- api-reports/2_12.txt | 10 ++++++ api-reports/2_13.txt | 10 ++++++ .../scalajs/dom/webgl/BroadcastChannel.scala | 33 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index b9f9637ca..7d344997f 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -612,6 +612,16 @@ Body[JT] def bodyUsed: Boolean Body[JT] def formData(): js.Promise[FormData] Body[JT] def json(): js.Promise[js.Any] Body[JT] def text(): js.Promise[String] +BroadcastChannel[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BroadcastChannel[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BroadcastChannel[JC] def close(): Unit +BroadcastChannel[JC] def dispatchEvent(evt: Event): Boolean +BroadcastChannel[JC] def name: String +BroadcastChannel[JC] var onmessage: js.Function1[MessageEvent, _] +BroadcastChannel[JC] var onmessageerror: js.Function1[MessageEvent, _] +BroadcastChannel[JC] def postMessage(message: Any): Unit +BroadcastChannel[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BroadcastChannel[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit CDATASection[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit CDATASection[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit CDATASection[JC] def appendChild(newChild: Node): Node diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index b9f9637ca..7d344997f 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -612,6 +612,16 @@ Body[JT] def bodyUsed: Boolean Body[JT] def formData(): js.Promise[FormData] Body[JT] def json(): js.Promise[js.Any] Body[JT] def text(): js.Promise[String] +BroadcastChannel[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BroadcastChannel[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +BroadcastChannel[JC] def close(): Unit +BroadcastChannel[JC] def dispatchEvent(evt: Event): Boolean +BroadcastChannel[JC] def name: String +BroadcastChannel[JC] var onmessage: js.Function1[MessageEvent, _] +BroadcastChannel[JC] var onmessageerror: js.Function1[MessageEvent, _] +BroadcastChannel[JC] def postMessage(message: Any): Unit +BroadcastChannel[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +BroadcastChannel[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit CDATASection[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit CDATASection[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit CDATASection[JC] def appendChild(newChild: Node): Node diff --git a/dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala b/dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala new file mode 100644 index 000000000..9ee800c99 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala @@ -0,0 +1,33 @@ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSGlobal + +/** A named channel that any browsing context of a given origin can subscribe to. It allows communication between + * different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via + * a message event fired at all BroadcastChannel objects listening to the channel, except the object that sent the + * message. + */ +@js.native +@JSGlobal +class BroadcastChannel(channelName: String) extends EventTarget { + + /** Uniquely identifies the given channel with its name */ + def name: String = js.native + + /** terminates the connection to the underlying channel, allowing the object to be garbage collected */ + def close(): Unit = js.native + + /** Sends a message, which can be of any kind of Object, to each listener in any browsing context with the same origin + */ + def postMessage(message: Any): Unit = js.native + + /** The message event is fired on a BroadcastChannel object when a message arrives on that channel */ + var onmessage: js.Function1[MessageEvent, _] = js.native + + /** The messageerror event is fired on a BroadcastChannel object when a message that can't be deserialized arrives on + * the channel + */ + var onmessageerror: js.Function1[MessageEvent, _] = js.native + +} From ecc7b05167721ebc5c2d189ad44066f0bce78f23 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 23 Sep 2023 15:10:28 -0700 Subject: [PATCH 10/13] Move `BroadcastChannel` to `dom` directory --- .../main/scala/org/scalajs/dom/{webgl => }/BroadcastChannel.scala | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dom/src/main/scala/org/scalajs/dom/{webgl => }/BroadcastChannel.scala (100%) diff --git a/dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala b/dom/src/main/scala/org/scalajs/dom/BroadcastChannel.scala similarity index 100% rename from dom/src/main/scala/org/scalajs/dom/webgl/BroadcastChannel.scala rename to dom/src/main/scala/org/scalajs/dom/BroadcastChannel.scala From ce8678d6d45eedd3b65a680cc53e44f6a3f2b697 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 25 Sep 2023 14:31:27 -0700 Subject: [PATCH 11/13] Doc fixes Co-authored-by: zetashift --- dom/src/main/scala/org/scalajs/dom/Performance.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/src/main/scala/org/scalajs/dom/Performance.scala b/dom/src/main/scala/org/scalajs/dom/Performance.scala index 04731c8b0..d629b468b 100644 --- a/dom/src/main/scala/org/scalajs/dom/Performance.scala +++ b/dom/src/main/scala/org/scalajs/dom/Performance.scala @@ -31,7 +31,7 @@ class Performance private[this] () extends js.Object { /** Returns an array of [[PerformanceEntry]] objects currently present in the performance timeline for a given type */ def getEntriesByType(entryType: String): js.Array[PerformanceEntry] = js.native - /** Is a jsonizer returning a json object representing the Performance object. */ + /** Returns a JSON representation of the [[Performance]] object. */ def toJSON(): js.Object = js.native @deprecated("No such API in the spec", "2.4.0") @@ -70,7 +70,7 @@ class Performance private[this] () extends js.Object { /** Removes all or specific [[PerformanceMeasure]] objects from the browser's performance timeline. */ def clearMeasures(measureName: String = js.native): Unit = js.native - /** sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries. */ + /** Sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries. */ def setResourceTimingBufferSize(maxSize: Int): Unit = js.native /** Returns a DOMHighResTimeStamp representing the amount of milliseconds elapsed since the start of the navigation, From b2d400b262fe0b9541799fe8cdb73621e0a00c7d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 26 Sep 2023 17:43:35 +0000 Subject: [PATCH 12/13] Update deprecation version --- api-reports/2_12.txt | 4 ++-- api-reports/2_13.txt | 4 ++-- dom/src/main/scala/org/scalajs/dom/Performance.scala | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 7c307825a..a57634964 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15766,8 +15766,8 @@ Performance[JC] def clearResourceTimings(): Unit Performance[JC] def getEntries(): js.Array[PerformanceEntry] Performance[JC] def getEntriesByName(name: String, `type`: String?): js.Array[PerformanceEntry] Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] -Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.4.0) -Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.8.0) +Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.8.0) Performance[JC] def mark(markName: String): PerformanceMark Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): PerformanceMeasure Performance[JC] def navigation: PerformanceNavigation diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 7c307825a..a57634964 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15766,8 +15766,8 @@ Performance[JC] def clearResourceTimings(): Unit Performance[JC] def getEntries(): js.Array[PerformanceEntry] Performance[JC] def getEntriesByName(name: String, `type`: String?): js.Array[PerformanceEntry] Performance[JC] def getEntriesByType(entryType: String): js.Array[PerformanceEntry] -Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.4.0) -Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.4.0) +Performance[JC] def getMarks(markName: String?): js.Dynamic (@deprecated in 2.8.0) +Performance[JC] def getMeasures(measureName: String?): js.Dynamic (@deprecated in 2.8.0) Performance[JC] def mark(markName: String): PerformanceMark Performance[JC] def measure(measureName: String, startMarkName: String?, endMarkName: String?): PerformanceMeasure Performance[JC] def navigation: PerformanceNavigation diff --git a/dom/src/main/scala/org/scalajs/dom/Performance.scala b/dom/src/main/scala/org/scalajs/dom/Performance.scala index d629b468b..0d25706ef 100644 --- a/dom/src/main/scala/org/scalajs/dom/Performance.scala +++ b/dom/src/main/scala/org/scalajs/dom/Performance.scala @@ -34,13 +34,13 @@ class Performance private[this] () extends js.Object { /** Returns a JSON representation of the [[Performance]] object. */ def toJSON(): js.Object = js.native - @deprecated("No such API in the spec", "2.4.0") + @deprecated("No such API in the spec", "2.8.0") def getMeasures(measureName: String = js.native): js.Dynamic = js.native /** Removes all or specific [[PerformanceMark]] objects from the browser's performance timeline. */ def clearMarks(markName: String = js.native): Unit = js.native - @deprecated("No such API in the spec", "2.4.0") + @deprecated("No such API in the spec", "2.8.0") def getMarks(markName: String = js.native): js.Dynamic = js.native /** Removes all performance entries with an `entryType` of "resource" from the browser's performance timeline and sets From 9c8796da0b428acccd8fdf8ac0674ba10a87666d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 27 Sep 2023 18:05:19 +0000 Subject: [PATCH 13/13] Fix type of `ImageData#data` --- api-reports/2_12.txt | 2 +- api-reports/2_13.txt | 2 +- dom/src/main/scala/org/scalajs/dom/ImageData.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index eb5476bc1..5d3785054 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -15465,7 +15465,7 @@ ImageBitmap[JT] def width: Double ImageCapture[JC] def grabFrame(): js.Promise[ImageBitmap] ImageCapture[JC] def takePhoto(): js.Promise[Blob] ImageCapture[JC] val track: MediaStreamTrack -ImageData[JC] def data: js.Array[Int] +ImageData[JC] def data: js.typedarray.Uint8ClampedArray ImageData[JC] def height: Int ImageData[JC] def width: Int InputEvent[JC] def bubbles: Boolean diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index eb5476bc1..5d3785054 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -15465,7 +15465,7 @@ ImageBitmap[JT] def width: Double ImageCapture[JC] def grabFrame(): js.Promise[ImageBitmap] ImageCapture[JC] def takePhoto(): js.Promise[Blob] ImageCapture[JC] val track: MediaStreamTrack -ImageData[JC] def data: js.Array[Int] +ImageData[JC] def data: js.typedarray.Uint8ClampedArray ImageData[JC] def height: Int ImageData[JC] def width: Int InputEvent[JC] def bubbles: Boolean diff --git a/dom/src/main/scala/org/scalajs/dom/ImageData.scala b/dom/src/main/scala/org/scalajs/dom/ImageData.scala index 1c048a1cd..ebf20f1d7 100644 --- a/dom/src/main/scala/org/scalajs/dom/ImageData.scala +++ b/dom/src/main/scala/org/scalajs/dom/ImageData.scala @@ -23,7 +23,7 @@ class ImageData extends js.Object { /** Is a Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer * values between 0 and 255 (included). */ - def data: js.Array[Int] = js.native + def data: js.typedarray.Uint8ClampedArray = js.native /** Is an unsigned long representing the actual height, in pixels, of the ImageData. */ def height: Int = js.native