ImportMaps.js 770 B

1234567891011121314151617181920212223242526272829303132
  1. class ImportMaps {
  2. static isAvailable() {
  3. return ( 'supports' in HTMLScriptElement && HTMLScriptElement.supports( 'importmap' ) );
  4. }
  5. static getErrorMessage() {
  6. const message = 'Your browser does not support <a href="https://wicg.github.io/import-maps/" style="color:blue">Import Maps</a>';
  7. const element = document.createElement( 'div' );
  8. element.style.fontFamily = 'monospace';
  9. element.style.fontSize = '13px';
  10. element.style.fontWeight = 'normal';
  11. element.style.textAlign = 'center';
  12. element.style.background = '#fff';
  13. element.style.color = '#000';
  14. element.style.padding = '1.5em';
  15. element.style.width = '400px';
  16. element.style.margin = '5em auto 0';
  17. element.innerHTML = message;
  18. return element;
  19. }
  20. }
  21. export default ImportMaps;