Skip to content

Commit

Permalink
client modules example: log document.title to see bug in action
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed May 27, 2022
1 parent c546c41 commit d1596e4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions website/_dogfooding/clientModuleExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ function logPage(
location: Location,
previousLocation: Location | null,
): void {
console.log(`${event}
Previous location: ${previousLocation?.pathname}
Current location: ${location.pathname}
Current heading: ${document.getElementsByTagName('h1')[0]?.innerText}`);
console.log(event, location.pathname, {
location,
prevLocation: previousLocation,
heading: document.getElementsByTagName('h1')[0]?.innerText,
title: document.title,
description: (
document.querySelector('meta[name="description"]') as HTMLMetaElement
)?.content,
htmlClassName: document.getElementsByTagName('html')[0]?.className,
});
}

export function onRouteUpdate({
Expand Down

0 comments on commit d1596e4

Please sign in to comment.