summaryrefslogtreecommitdiff
path: root/cli/js/web/util.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-07-11 12:38:15 +1000
committerGitHub <noreply@github.com>2020-07-10 22:38:15 -0400
commit40d081d3d9f64bcd2524da86fb78808ac1d7b888 (patch)
tree2232fda10c06d80d749f975b691974c506caa63d /cli/js/web/util.ts
parentd01eb6d9c506eef765fde8e40f9b90619b2ec83c (diff)
feat: add performance user timing APIs (#6421)
Diffstat (limited to 'cli/js/web/util.ts')
-rw-r--r--cli/js/web/util.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/js/web/util.ts b/cli/js/web/util.ts
index 53ff8ef22..281048cd8 100644
--- a/cli/js/web/util.ts
+++ b/cli/js/web/util.ts
@@ -208,3 +208,11 @@ export function getHeaderValueParams(value: string): Map<string, string> {
export function hasHeaderValueOf(s: string, value: string): boolean {
return new RegExp(`^${value}[\t\s]*;?`).test(s);
}
+
+/** An internal function which provides a function name for some generated
+ * functions, so stack traces are a bit more readable.
+ *
+ * @internal */
+export function setFunctionName(fn: Function, value: string): void {
+ Object.defineProperty(fn, "name", { value, configurable: true });
+}