Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "is-mobile in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'is-mobile' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

import Api from '@/utils/api';
import {IStorage} from '@/types/types';
import loggerFactory from '@/utils/loggerFactory';
import sessionHolder from '@/utils/sessionHolder';
import {Logger} from 'lines-logger';
import {WS_API_URL} from '@/utils/consts';
import NotifierHandler from '@/utils/NotificationHandler';
import Vue from 'vue';
import Http from '@/utils/Http';
import WebRtcApi from '@/webrtc/WebRtcApi';
import {store} from '@/utils/storeHolder';

export const xhr: Http = /* window.fetch ? new Fetch(XHR_API_URL, sessionHolder) :*/ new Xhr(sessionHolder);
export const api: Api = new Api(xhr);
export const isMobile: boolean = mobile.isMobile();
export const messageBus = new Vue();
export const browserVersion: string = (function () {
  let ua = navigator.userAgent, tem,
      M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
  if (/trident/i.test(M[1])) {
    tem = /\brv[ :]+(\d+)/g.exec(ua) || [];

    return 'IE ' + (tem[1] || '');
  }
  if (M[1] === 'Chrome') {
    tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
    if (tem != undefined) { return tem.slice(1).join(' ').replace('OPR', 'Opera'); }
  }
  M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
  if ((tem = ua.match(/version\/(\d+)/i)) != undefined) { M.splice(1, 1, tem[1]); }
import { detect } from 'detect-browser'
import detectMobile from 'is-mobile'

/**
 * Application Constants
 * @ignore
 */

export const isElectron = navigator.userAgent.indexOf( 'Electron' ) > -1
export const isDev = process.env.NODE_ENV !== 'production'

export const browser = detect()
export const isMac = browser.os === 'Mac OS'
export const isMobile = detectMobile()
export const isTablet = detectMobile( { tablet: true } )
export const isDesktop = !( isMobile || isTablet )

// The user is considered idle after 3 seconds
export const IDLE_TIMEOUT = 1000 * 3

/* Backend Info */
// eslint-disable-next-line no-undef
export const BACKEND_HOST = window.location.hostname || 'localhost'
export const BACKEND_PORT = !isDev ? 1699 : 42425
export const BACKEND_URL = `http://${BACKEND_HOST}:${BACKEND_PORT}`
export const WS_URL = `ws://${BACKEND_HOST}:${BACKEND_PORT}`

/* Sentry Data Source Name */
export const SENTRY_DSN = 'https://51b714c1e7544cba86efb2cad85152ff@sentry.io/1363390'
export const SENTRY_PROJECT = 'desktop-frontend'
constructor(props) {
    super()

    this.state = {
      filters: props.filters,
      totalStaked: 0,
      inApplication: 0,
      inCommit: 0,
      inReveal: 0,
      inRegistry: 0,
      withdrawn: 0,
      rejected: 0,
      fetching: false,
      showFilters: !isMobile(),
      toggle: true
    }

    this.onSearchInput = this.onSearchInput.bind(this)
    this.onFilterChange = this.onFilterChange.bind(this)
    this.onFiltersChange = props.onFiltersChange.bind(this)
    this.resetFilters = this.resetFilters.bind(this)

    // this.fetchStats()
  }
async function init() {

  let hasAcceptedMobile
  try {
    hasAcceptedMobile = store.get('hasAcceptedMobile')
  } catch (error) {
    console.log(error)
  }
  if (isMobile() && !hasAcceptedMobile && !window.web3) {
    ReactDOM.render(, document.getElementById('root'))
    return
  }

  try {
    await Promise.all([
      getPermissions(),
      registry.init(),
      plcr.init(),
      parameterizer.init(),
      token.init()
    ])

  } catch (error) {
    console.error(error)
  }
private playVideo(media: Media) {
    if (!this.videoElement) {
      console.warn('playVideo called before videoElement initialised');
      return;
    }

    if (this.initialised) {
      return;
    } else {
      this.initialised = true;
    }

    const autoPlay = !isMobile() && this.config && this.config.user.autoplayEnabled;
    const lowQualityOnSeek =
      this.config &&
      (isMobile()
        ? this.config.user.lowQualityOnLoadEnabledForMobile
        : this.config.user.lowQualityOnLoadEnabled);
    console.debug('playing video', media.hash, lowQualityOnSeek, autoPlay);

    this.hls = new Hls({
      autoStartLoad: false,
      capLevelToPlayerSize: true,
      maxSeekHole: 5,
      maxBufferHole: 5,
      maxBufferLength: 20,
      startLevel: lowQualityOnSeek ? 0 : -1,
    });

    this.syncVolume();

    this.hls.on(Hls.Events.MANIFEST_PARSED, (event, data) => {
private playVideo(media: Media) {
    if (!this.videoElement) {
      console.warn('playVideo called before videoElement initialised');
      return;
    }

    if (this.initialised) {
      return;
    } else {
      this.initialised = true;
    }

    const autoPlay = !isMobile() && this.config && this.config.user.autoplayEnabled;
    const lowQualityOnSeek =
      this.config &&
      (isMobile()
        ? this.config.user.lowQualityOnLoadEnabledForMobile
        : this.config.user.lowQualityOnLoadEnabled);
    console.debug('playing video', media.hash, lowQualityOnSeek, autoPlay);

    this.hls = new Hls({
      autoStartLoad: false,
      capLevelToPlayerSize: true,
      maxSeekHole: 5,
      maxBufferHole: 5,
      maxBufferLength: 20,
      startLevel: lowQualityOnSeek ? 0 : -1,
    });
const start = ascending ? min : max;
  const end = ascending ? max + 1 : min - 1;

  return range(start, end).map(year => {
    const yearStr = String(year);

    return (
      <option value="{yearStr}">
        {yearStr}
      </option>
    );
  });
};

const currYear = new Date().getFullYear();
const renderNativeInput = isMobile({ tablet: true });

const customValueToString = ({ month, year }: MonthPickerValue) =&gt;
  month &amp;&amp; year ? `${year}-${month &lt; 10 ? '0' : ''}${month}` : undefined;

const stringToCustomValue = (value: string) =&gt; {
  const [year, month] = value.split('-');

  return {
    month: parseInt(month, 10),
    year: parseInt(year, 10),
  };
};

const makeChangeHandler = &lt;
  Element extends HTMLSelectElement | HTMLInputElement
&gt;(
export default props =&gt; {
  if (!isMobile(navigator.userAgent)) {
    ReactDOM.render(
      
        
      ,
      node,
    );
  }
};
const update = () =&gt; {
  const { filenameSelector, iconSelector, host } = getSelector(
    window.location.hostname
  );
  const isMobile = mobile();
  const isGitHub = host === 'github';

  const filenameDoms = select.all(filenameSelector);
  const iconDoms = select.all(iconSelector);

  const filenameDomsLength = filenameDoms.length;

  for (let i = 0; i &lt; filenameDomsLength; i += 1) {
    const filename =
      isGitHub &amp;&amp; isMobile
        ? getGitHubMobileFilename(filenameDoms[i])
        : filenameDoms[i].innerText.trim();

    const iconDom = isGitHub
      ? iconDoms[i].querySelector('.octicon')
      : iconDoms[i];
import Download from 'react-icons/lib/fa/cloud-download'
import LoadIcon from 'react-icons/lib/fa/spinner'
import LoopIcon from 'react-icons/lib/md/repeat-one'
import RepeatIcon from 'react-icons/lib/md/repeat'
import ShufflePlayIcon from 'react-icons/lib/ti/arrow-shuffle'
import OrderPlayIcon from 'react-icons/lib/md/view-headline'
import PlayLists from 'react-icons/lib/md/queue-music'
import NextAudioIcon from 'react-icons/lib/md/skip-next'
import PrevAudioIcon from 'react-icons/lib/md/skip-previous'
import CloseBtn from 'react-icons/lib/md/close'
import DeleteIcon from 'react-icons/lib/fa/trash-o'

import 'rc-slider/assets/index.css'
import 'rc-switch/assets/index.css'

const IS_MOBILE = isMobile()

export const AnimatePlayIcon = () =&gt; (
  
)
export const AnimatePauseIcon = () =&gt; (
  
)

export const Load = () =&gt; (
  <span>
    
  </span>
)

export const PlayModel = ({ visible, value }) =&gt; (

Is your System Free of Underlying Vulnerabilities?
Find Out Now