Get started with is_js CDN

MIT licensed

Variable/function is_js: checks if given environment is JS.

Tags:
  • type
  • presence
  • regexp
  • string
  • arithmetic
  • object
  • array
  • environment
  • time
  • configuration

Stable version

Copied!

How to start using is_js CDN


// Include the is_js library from the CDN
const isJs = (() => {
  const script = document.createElement('script');
  script.src = 'https://cdn.cdnhub.io/is_js/0.9.0/is.min.js';
  script.async = true;
  script.onload = () => {
    window.is = window.is || {};
    return window.is;
  };
  document.head.appendChild(script);

  return new Promise(resolve => {
    window.onload = () => {
      if (typeof window.is === 'object') {
        resolve(window.is);
      }
    };
  });
})();

// Usage example
async function checkBrowserSupport() {
  const browserSupportsWebComponents = await isJs.is('features.custom-elements');
  if (browserSupportsWebComponents) {
    console.log('Browser supports custom elements.');
  } else {
    console.log('Browser does not support custom elements.');
  }
}

checkBrowserSupport();
Copied!
Copied!

All versions