Skip to content

Commit de1b2c9

Browse files
authored
fix(tracing): Add manual Location typing (#2700)
* fix(tracing): Add manual Location typing * CHANGELOG
1 parent 016fc00 commit de1b2c9

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
6+
- [tracing] fix: Add manual Location typing (#2700)
67

78
## 5.18.1
89

packages/apm/src/integrations/tracing.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { Span as SpanClass } from '../span';
1515
import { SpanStatus } from '../spanstatus';
1616
import { Transaction } from '../transaction';
1717

18+
import { Location } from './types';
19+
1820
/**
1921
* Options for Tracing integration
2022
*/
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to.
3+
* Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.
4+
*
5+
* Copy Location interface so that user's dont have to include dom typings with Tracing integration
6+
* Based on https://github.com/microsoft/TypeScript/blob/4cf0afe2662980ebcd8d444dbd13d8f47d06fcd5/lib/lib.dom.d.ts#L9691
7+
*/
8+
export interface Location {
9+
/**
10+
* Returns a DOMStringList object listing the origins of the ancestor browsing contexts, from the parent browsing context to the top-level browsing context.
11+
*/
12+
readonly ancestorOrigins: DOMStringList;
13+
/**
14+
* Returns the Location object's URL's fragment (includes leading "#" if non-empty).
15+
*
16+
* Can be set, to navigate to the same URL with a changed fragment (ignores leading "#").
17+
*/
18+
hash: string;
19+
/**
20+
* Returns the Location object's URL's host and port (if different from the default port for the scheme).
21+
*
22+
* Can be set, to navigate to the same URL with a changed host and port.
23+
*/
24+
host: string;
25+
/**
26+
* Returns the Location object's URL's host.
27+
*
28+
* Can be set, to navigate to the same URL with a changed host.
29+
*/
30+
hostname: string;
31+
/**
32+
* Returns the Location object's URL.
33+
*
34+
* Can be set, to navigate to the given URL.
35+
*/
36+
href: string;
37+
// tslint:disable-next-line: completed-docs
38+
toString(): string;
39+
/**
40+
* Returns the Location object's URL's origin.
41+
*/
42+
readonly origin: string;
43+
/**
44+
* Returns the Location object's URL's path.
45+
*
46+
* Can be set, to navigate to the same URL with a changed path.
47+
*/
48+
pathname: string;
49+
/**
50+
* Returns the Location object's URL's port.
51+
*
52+
* Can be set, to navigate to the same URL with a changed port.
53+
*/
54+
port: string;
55+
/**
56+
* Returns the Location object's URL's scheme.
57+
*
58+
* Can be set, to navigate to the same URL with a changed scheme.
59+
*/
60+
protocol: string;
61+
/**
62+
* Returns the Location object's URL's query (includes leading "?" if non-empty).
63+
*
64+
* Can be set, to navigate to the same URL with a changed query (ignores leading "?").
65+
*/
66+
search: string;
67+
/**
68+
* Navigates to the given URL.
69+
*/
70+
assign(url: string): void;
71+
/**
72+
* Reloads the current page.
73+
*/
74+
reload(): void;
75+
/** @deprecated */
76+
// tslint:disable-next-line: unified-signatures completed-docs
77+
reload(forcedReload: boolean): void;
78+
/**
79+
* Removes the current page from the session history and navigates to the given URL.
80+
*/
81+
replace(url: string): void;
82+
}

0 commit comments

Comments
 (0)