-
Notifications
You must be signed in to change notification settings - Fork 161
Performance api improvements #709
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
Changes from 2 commits
6d6a3cd
38b8988
cbc769f
1ee7b40
12deff1
1066217
12eea31
ce8678d
b2d400b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there are only a limited set of values that can be passed as an E.g. like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, maybe I was wrong 😅
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/supportedEntryTypes |
||
|
||
/** Is a jsonizer returning a json object representing the Performance object. */ | ||
armanbilge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot create objects of type
Performance
. Is this the correct way to forbid it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think we do this in other places as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is correct.