Service workers are event-based, so we'll listen for the install
and activate
events, which will let us execute code when our PWA gets installed for the first time. We'll use setTimeout
to simulate an asynchronous action and wait for that to complete, before allowing the PWA to continue installing.