How to use the current-device.android function in current-device

To help you get started, we’ve selected a few current-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kotarella1110 / cordova-plugin-webpack / src / www / injectCordovaScript.ts View on Github external
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');
}

current-device

The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo, AppleTV, etc), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).

MIT
Latest version published 4 years ago

Package Health Score

61 / 100
Full package analysis