1
1
/**
2
- * @typedef {import("./types.ts").ExtendedWindow } ExtendedWindow
3
2
* @typedef {import("./types.ts").ViewTransitionsConfig } ViewTransitionsConfig
4
3
* @typedef {import("./types.ts").InitViewTransitionsFunction } InitViewTransitionsFunction
5
4
* @typedef {import("./types.ts").PageSwapListenerFunction } PageSwapListenerFunction
6
5
* @typedef {import("./types.ts").PageRevealListenerFunction } PageRevealListenerFunction
7
6
*/
8
7
9
- /**
10
- * Window reference to reduce size when script is minified.
11
- *
12
- * @type {ExtendedWindow }
13
- */
14
- const win = window ;
15
-
16
8
/**
17
9
* Initializes view transitions for the current URL.
18
10
*
19
11
* @type {InitViewTransitionsFunction }
20
12
* @param {ViewTransitionsConfig } config - The view transitions configuration.
21
13
*/
22
- win . plvtInitViewTransitions = ( config ) => {
23
- if ( ! win . navigation || ! ( 'CSSViewTransitionRule' in win ) ) {
24
- win . console . warn (
14
+ window . plvtInitViewTransitions = ( config ) => {
15
+ if ( ! window . navigation || ! ( 'CSSViewTransitionRule' in window ) ) {
16
+ window . console . warn (
25
17
'View transitions not loaded as the browser is lacking support.'
26
18
) ;
27
19
return ;
@@ -135,7 +127,7 @@ win.plvtInitViewTransitions = ( config ) => {
135
127
* @type {PageSwapListenerFunction }
136
128
* @param {PageSwapEvent } event - Event fired as the previous URL is about to unload.
137
129
*/
138
- win . addEventListener (
130
+ window . addEventListener (
139
131
'pageswap' ,
140
132
( /** @type {PageSwapEvent } */ event ) => {
141
133
if ( event . viewTransition ) {
@@ -170,7 +162,7 @@ win.plvtInitViewTransitions = ( config ) => {
170
162
* @type {PageRevealListenerFunction }
171
163
* @param {PageRevealEvent } event - Event fired as the new URL being navigated to is loaded.
172
164
*/
173
- win . addEventListener (
165
+ window . addEventListener (
174
166
'pagereveal' ,
175
167
( /** @type {PageRevealEvent } */ event ) => {
176
168
if ( event . viewTransition ) {
@@ -186,9 +178,9 @@ win.plvtInitViewTransitions = ( config ) => {
186
178
) {
187
179
viewTransitionEntries = getViewTransitionEntries (
188
180
document . body ,
189
- win . navigation . activation . from
181
+ window . navigation . activation . from
190
182
? getArticleForUrl (
191
- win . navigation . activation . from . url
183
+ window . navigation . activation . from . url
192
184
)
193
185
: null
194
186
) ;
0 commit comments