Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tfjs-core/src/device_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*/

// tslint:disable-next-line:no-any
export function isNavigatorDefined(): boolean {
function _isNavigatorDefined(): boolean {
return typeof navigator !== 'undefined' && navigator != null;
}

export function isMobile(): boolean {
if (isNavigatorDefined()) {
if (_isNavigatorDefined()) {
// tslint:disable-next-line:no-any
const a = navigator.userAgent || navigator.vendor || (window as any).opera;
// tslint:disable-next-line:max-line-length
Expand Down
6 changes: 0 additions & 6 deletions tfjs-core/src/device_util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ import * as device_util from './device_util';
import {ALL_ENVS, describeWithFlags} from './jasmine_util';

describeWithFlags('isMobile', ALL_ENVS, () => {
it('should not fail when navigator is not set', () => {
spyOn(device_util, 'isNavigatorDefined').and.returnValue(false);
expect(device_util.isMobile()).toBeFalsy();
});

it('should not fail when navigator is set', () => {
spyOn(device_util, 'isNavigatorDefined').and.returnValue(true);
expect(() => device_util.isMobile()).not.toThrow();
});
});