Permalink
Browse files

Prevent a type error after worker disconnect

Redo the Firefox Android check so that the worker can attempt to
auto-reconnect successfully and not get tripped up by the absence of a
user agent string.
  • Loading branch information...
lovett committed Nov 29, 2018
1 parent fe008e7 commit b610cbafcdc999735c523a320ec668353c20b9e9
Showing with 3 additions and 1 deletion.
  1. +3 −1 worker/receiver.ts
@@ -17,7 +17,9 @@ export class Receiver {
// entirely terrible because usage is probably short-lived
// anyway. A long-running connection isn't happening on mobile
// the way it is on desktop.
if (userAgent!.indexOf('Android') > -1 && userAgent!.indexOf('Firefox') > -1) {
const isAndroid = userAgent && userAgent.indexOf('Android') > -1;
const isFirefox = userAgent && userAgent.indexOf('Firefox') > -1;
if (isAndroid && isFirefox) {
const reply = new WorkerMessage(WorkerEvent.connected);
return reply.send();
}

0 comments on commit b610cba

Please sign in to comment.