Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "current-device in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'current-device' 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.

? getSelection({
        state,
        windowType: props.parentWindowType,
        viewId: props.parentDefaultViewId,
      })
    : NO_SELECTION,
  modal: state.windowHandler.modal,
});

const NO_SELECTION = [];
const NO_VIEW = {};
const PANEL_WIDTHS = ['1', '.2', '4'];
const GEO_PANEL_STATES = ['grid', 'all', 'map'];

// for mobile devices we only want to show either map or grid
if (currentDevice.type === 'mobile' || currentDevice.type === 'tablet') {
  GEO_PANEL_STATES.splice(1, 1);
}

const filtersToMap = function(filtersArray) {
  let filtersMap = Map();

  if (filtersArray && filtersArray.length) {
    filtersArray.forEach(filter => {
      filtersMap = filtersMap.set(filter.filterId, filter);
    });
  }
  return filtersMap;
};

const doesSelectionExist = function({
  data,
constructor(props) {
    super(props);

    const { defaultViewId, defaultPage, defaultSort } = props;

    this.pageLength =
      currentDevice.type === 'mobile' || currentDevice.type === 'tablet'
        ? 9999
        : 100;
    this.supportAttribute = false;

    this.state = {
      data: null, // view result (result, firstRow, pageLength etc)
      layout: null,
      pageColumnInfosByFieldName: null,
      toggleWidth: 0,
      viewId: defaultViewId,
      page: defaultPage || 1,
      sort: defaultSort,
      filtersActive: Map(),
      initialValuesNulled: Map(),
      clickOutsideLock: true,
      isShowIncluded: false,
// 播放视频广告
  playVideoAd () {
    this.setAdInterval()
    this.player.play()
  }

  // 暂停视频广告 
  pauseVideoAd () {
    this.clearAdInterval()
    this.player.pause()
  }
}

let defaultComponent = VideoAdComponent

if (device.mobile()) {
  defaultComponent = MbVideoAdComponent
}

export default defaultComponent
const existingScriptEl = document.querySelector(
    'script[src="cordova.js"]',
  );
  if (existingScriptEl) existingScriptEl.remove();

  const scriptEl = document.createElement('script');
  scriptEl.setAttribute('type', 'text/javascript');
  scriptEl.setAttribute('src', `${platform}/cordova.js`);
  document.body.appendChild(scriptEl);

  console.log(`Injected cordova.js of ${platform} platform.`);
};

if (!isWebview(navigator.userAgent)) {
  injectCordovaScript('browser');
} else if (currentDevice.android()) {
  injectCordovaScript('android');
} else if (currentDevice.ios()) {
  injectCordovaScript('ios');
}
const deviceJs = require('current-device').default;

function bodyPrepend(platform) {
  let body = document.querySelector("body"),
    script = document.createElement("script");

  script.onload = function () {
    console.log("Cordova script loaded!");
  };

  script.src = `platform_cordova_files/${platform}/cordova.js`;
  body.appendChild(script);


  console.log(`${platform} platform cordova.js injected.`);
}
function bodyPrepend(platform) {
  let body = document.querySelector("body"),
    script = document.createElement("script");

  script.onload = function () {
    console.log("Cordova script loaded!");
  };

  script.src = `platform_cordova_files/${platform}/cordova.js`;
  body.appendChild(script);


  console.log(`${platform} platform cordova.js injected.`);
}

if (deviceJs.android())
  bodyPrepend("android");
else if (deviceJs.ios())
  bodyPrepend("ios");
else
  bodyPrepend("browser");
script = document.createElement("script");

  script.onload = function () {
    console.log("Cordova script loaded!");
  };

  script.src = `platform_cordova_files/${platform}/cordova.js`;
  body.appendChild(script);


  console.log(`${platform} platform cordova.js injected.`);
}

if (deviceJs.android())
  bodyPrepend("android");
else if (deviceJs.ios())
  bodyPrepend("ios");
else
  bodyPrepend("browser");
);
  if (existingScriptEl) existingScriptEl.remove();

  const scriptEl = document.createElement('script');
  scriptEl.setAttribute('type', 'text/javascript');
  scriptEl.setAttribute('src', `${platform}/cordova.js`);
  document.body.appendChild(scriptEl);

  console.log(`Injected cordova.js of ${platform} platform.`);
};

if (!isWebview(navigator.userAgent)) {
  injectCordovaScript('browser');
} else if (currentDevice.android()) {
  injectCordovaScript('android');
} else if (currentDevice.ios()) {
  injectCordovaScript('ios');
}
constructor(props) {
    super(props);

    let val = 400;

    if (currentDevice.type === 'mobile') {
      val = 300;
    }

    this.width = val;
    this.height = val;
  }
  componentDidMount() {
onClose={val => {
                const value = typeof val !== 'undefined' ? val : false;
                this.scanBarcode(value);

                if (currentDevice.type === 'mobile') {
                  closeOverlay();
                }
              }}
            />

Is your System Free of Underlying Vulnerabilities?
Find Out Now