From 42e43730c82da0accaa63cb2b68a72564ddb34e9 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Wed, 24 Jun 2020 15:16:38 +0100 Subject: [PATCH] Naming changes --- src/components/intro/index.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx index 79ed6fa8..f8c95ad7 100644 --- a/src/components/intro/index.tsx +++ b/src/components/intro/index.tsx @@ -49,7 +49,7 @@ interface Props { } interface State { fetchingDemoIndex?: number; - installEvent?: BeforeInstallPromptEvent; + beforeInstallEvent?: BeforeInstallPromptEvent; } export default class Intro extends Component { @@ -110,7 +110,7 @@ export default class Intro extends Component { event.preventDefault(); // Save the beforeinstallprompt event so it can be called later. - this.setState({ installEvent: event }); + this.setState({ beforeInstallEvent: event }); // Log the event. ga('send', 'event', 'pwa-install', 'available'); @@ -119,17 +119,17 @@ export default class Intro extends Component { @bind private async onInstallClick(event: Event) { // Get the deferred beforeinstallprompt event - const deferredPrompt = this.state.installEvent; + const beforeInstallEvent = this.state.beforeInstallEvent; // If there's no deferred prompt, bail. - if (!deferredPrompt) return; + if (!beforeInstallEvent) return; this.installingViaButton = true; // Show the browser install prompt - deferredPrompt.prompt(); + beforeInstallEvent.prompt(); // Wait for the user to accept or dismiss the install prompt - const { outcome } = await deferredPrompt.userChoice; + const { outcome } = await beforeInstallEvent.userChoice; ga('send', 'event', 'pwa-install', installButtonSource, outcome); // If the prompt was dismissed, we aren't going to install via the button. @@ -146,10 +146,10 @@ export default class Intro extends Component { this.installingViaButton = false; // We don't need the install button, if it's shown - this.setState({ installEvent: undefined }); + this.setState({ beforeInstallEvent: undefined }); } - render({ }: Props, { fetchingDemoIndex, installEvent }: State) { + render({ }: Props, { fetchingDemoIndex, beforeInstallEvent }: State) { return (
@@ -191,7 +191,7 @@ export default class Intro extends Component { )}
- {installEvent && + {beforeInstallEvent &&