Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb committed Nov 15, 2022
1 parent b894478 commit 43a116b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/types.ts
Expand Up @@ -58,9 +58,11 @@ interface PerformanceEntryMap {

// Update built-in types to be more accurate.
declare global {
// https://wicg.github.io/nav-speculation/prerendering.html#document-prerendering
interface Document {
prerendering?: boolean
// https://wicg.github.io/nav-speculation/prerendering.html#document-prerendering
prerendering?: boolean;
// https://github.com/WICG/page-lifecycle/blob/main/README.md
wasDiscarded?: boolean;
}

interface Performance {
Expand Down
9 changes: 0 additions & 9 deletions src/types/base.ts
Expand Up @@ -105,12 +105,3 @@ export interface ReportOpts {
* loading. This is equivalent to the corresponding `readyState` value.
*/
export type LoadState = 'loading' | 'dom-interactive' | 'dom-content-loaded' | 'complete';

/**
* Extend the document with the new wasDiscarded boolean which is not supported
* in typescript yet
* https://github.com/WICG/page-lifecycle/blob/main/README.md
*/
declare global {
interface Document { wasDiscarded?: boolean; }
}
1 change: 0 additions & 1 deletion test/views/layout.njk
Expand Up @@ -105,7 +105,6 @@
*/
self.__stubWasDiscarded = () => {
return new Promise((resolve) => {
const navEntry = performance.getEntriesByType('navigation')[0];
// Only stub if the page isn't actually discarded.
if (!document.wasDiscarded) {
Object.defineProperty(document, 'wasDiscarded', {
Expand Down

0 comments on commit 43a116b

Please sign in to comment.