Skip to content

Commit e1374d3

Browse files
falsandtruzhengbli
authored andcommitted
Fix the History api (#142)
1 parent 382b7a0 commit e1374d3

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

baselines/dom.generated.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7536,11 +7536,12 @@ declare var HashChangeEvent: {
75367536
interface History {
75377537
readonly length: number;
75387538
readonly state: any;
7539-
back(distance?: any): void;
7540-
forward(distance?: any): void;
7541-
go(delta?: any): void;
7542-
pushState(statedata: any, title?: string, url?: string): void;
7543-
replaceState(statedata: any, title?: string, url?: string): void;
7539+
scrollRestoration: ScrollRestoration;
7540+
back(): void;
7541+
forward(): void;
7542+
go(delta?: number): void;
7543+
pushState(data: any, title: string, url?: string | null): void;
7544+
replaceState(data: any, title: string, url?: string | null): void;
75447545
}
75457546

75467547
declare var History: {
@@ -14622,4 +14623,5 @@ type ScrollBehavior = "auto" | "instant" | "smooth";
1462214623
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
1462314624
type IDBValidKey = number | string | Date | IDBArrayKey;
1462414625
type BufferSource = ArrayBuffer | ArrayBufferView;
14625-
type MouseWheelEvent = WheelEvent;
14626+
type MouseWheelEvent = WheelEvent;
14627+
type ScrollRestoration = "auto" | "manual";

inputfiles/addedTypes.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,5 +1175,17 @@
11751175
"kind": "extends",
11761176
"baseInterface": "ParentNode",
11771177
"interface": "DocumentFragment"
1178+
},
1179+
{
1180+
"kind": "typedef",
1181+
"name": "ScrollRestoration",
1182+
"flavor": "DOM",
1183+
"type": "\"auto\" | \"manual\""
1184+
},
1185+
{
1186+
"kind": "property",
1187+
"interface": "History",
1188+
"name": "scrollRestoration",
1189+
"type": "ScrollRestoration"
11781190
}
11791191
]

inputfiles/overridingTypes.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,5 +815,35 @@
815815
"interface": "Window",
816816
"name": "opener",
817817
"type": "any"
818-
}
818+
},
819+
{
820+
"kind": "method",
821+
"interface": "History",
822+
"name": "back",
823+
"signatures": ["back(): void"]
824+
},
825+
{
826+
"kind": "method",
827+
"interface": "History",
828+
"name": "forward",
829+
"signatures": ["forward(): void"]
830+
},
831+
{
832+
"kind": "method",
833+
"interface": "History",
834+
"name": "go",
835+
"signatures": ["go(delta?: number): void"]
836+
},
837+
{
838+
"kind": "method",
839+
"interface": "History",
840+
"name": "pushState",
841+
"signatures": ["pushState(data: any, title: string, url?: string | null): void"]
842+
},
843+
{
844+
"kind": "method",
845+
"interface": "History",
846+
"name": "replaceState",
847+
"signatures": ["replaceState(data: any, title: string, url?: string | null): void"]
848+
}
819849
]

0 commit comments

Comments
 (0)