Avoid attempts to create BroadcastChannel objects in contexts where the
object does not exist. Specifically, allow PhantomJS to run unit tesst
without dying on:
ReferenceError: Can't find variable: BroadcastChannel
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
},
// Listen for logout events in other tabs
- authChannel : new BroadcastChannel('eg.auth')
+ // Current version of phantomjs (unit tests, etc.) does not
+ // support BroadcastChannel, so just dummy it up.
+ authChannel : (typeof BroadcastChannel == 'undefined') ?
+ {} : new BroadcastChannel('eg.auth')
};
/* Returns a promise, which is resolved if valid