429
input: string | $TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
430
): number,
431
};
432
+
433
+// Navigation API
434
+
435
+declare const navigation: Navigation;
436
+
437
+interface NavigationResult {
438
+ committed: Promise<NavigationHistoryEntry>;
439
+ finished: Promise<NavigationHistoryEntry>;
440
+}
441
+
442
+declare class Navigation extends EventTarget {
443
+ entries(): NavigationHistoryEntry[];
444
+ +currentEntry: NavigationHistoryEntry | null;
445
+ updateCurrentEntry(options: NavigationUpdateCurrentEntryOptions): void;
446
+ +transition: NavigationTransition | null;
447
+
448
+ +canGoBack: boolean;
449
+ +canGoForward: boolean;
450
+
451
+ navigate(url: string, options?: NavigationNavigateOptions): NavigationResult;
452
+ reload(options?: NavigationReloadOptions): NavigationResult;
453
+
454
+ traverseTo(key: string, options?: NavigationOptions): NavigationResult;
455
+ back(options?: NavigationOptions): NavigationResult;
456
+ forward(options?: NavigationOptions): NavigationResult;
457
+
458
+ onnavigate: ((this: Navigation, ev: NavigateEvent) => any) | null;
459
+ onnavigatesuccess: ((this: Navigation, ev: Event) => any) | null;
460
+ onnavigateerror: ((this: Navigation, ev: ErrorEvent) => any) | null;
461
+ oncurrententrychange:
462
+ | ((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any)
463
+ | null;
464
+
465
+ // TODO: Implement addEventListener overrides. Doesn't seem like Flow supports this.
466
+}
467
+
468
+declare class NavigationTransition {
469
+ +navigationType: NavigationTypeString;
470
+ +from: NavigationHistoryEntry;
471
+ +finished: Promise<void>;
472
+}
473
+
474
+interface NavigationHistoryEntryEventMap {
475
+ dispose: Event;
476
+}
477
+
478
+interface NavigationHistoryEntry extends EventTarget {
479
+ +key: string;
480
+ +id: string;
481
+ +url: string | null;
482
+ +index: number;
483
+ +sameDocument: boolean;
484
+
485
+ getState(): mixed;
486
+
487
+ ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null;
488
+
489
+ // TODO: Implement addEventListener overrides. Doesn't seem like Flow supports this.
490
+}
491
+
492
+declare var NavigationHistoryEntry: {
493
+ prototype: NavigationHistoryEntry,
494
+ new(): NavigationHistoryEntry,
495
+};
496
+
497
+type NavigationTypeString = 'reload' | 'push' | 'replace' | 'traverse';
498
+
499
+interface NavigationUpdateCurrentEntryOptions {
500
+ state: mixed;
501
+}
502
+
503
+interface NavigationOptions {
504
+ info?: mixed;
505
+}
506
+
507
+interface NavigationNavigateOptions extends NavigationOptions {
508
+ state?: mixed;
509
+ history?: 'auto' | 'push' | 'replace';
510
+}
511
+
512
+interface NavigationReloadOptions extends NavigationOptions {
513
+ state?: mixed;
514
+}
515
+
516
+declare class NavigationCurrentEntryChangeEvent extends Event {
517
+ constructor(type: string, eventInit?: any): void;
518
+
519
+ +navigationType: NavigationTypeString | null;
520
+ +from: NavigationHistoryEntry;
521
+}
522
+
523
+declare class NavigateEvent extends Event {
524
+ constructor(type: string, eventInit?: any): void;
525
+
526
+ +navigationType: NavigationTypeString;
527
+ +canIntercept: boolean;
528
+ +userInitiated: boolean;
529
+ +hashChange: boolean;
530
+ +hasUAVisualTransition: boolean;
531
+ +destination: NavigationDestination;
532
+ +signal: AbortSignal;
533
+ +formData: FormData | null;
534
+ +downloadRequest: string | null;
535
+ +info?: mixed;
536
+
537
+ intercept(options?: NavigationInterceptOptions): void;
538
+ scroll(): void;
539
+}
540
+
541
+interface NavigationInterceptOptions {
542
+ handler?: () => Promise<void>;
543
+ focusReset?: 'after-transition' | 'manual';
544
+ scroll?: 'after-transition' | 'manual';
545
+}
546
+
547
+declare class NavigationDestination {
548
+ +url: string;
549
+ +key: string | null;
550
+ +id: string | null;
551
+ +index: number;
552
+ +sameDocument: boolean;
553
+
554
+ getState(): mixed;
555
+}