export const noop = () => {}; export function on( obj: T | null, ...args: Parameters | [string, Function | null, ...any] ): void { if (obj && obj.addEventListener) { obj.addEventListener(...(args as Parameters)); } } export function off( obj: T | null, ...args: Parameters | [string, Function | null, ...any] ): void { if (obj && obj.removeEventListener) { obj.removeEventListener(...(args as Parameters)); } } export const isBrowser = typeof window !== 'undefined'; export const isNavigator = typeof navigator !== 'undefined';