Skip to content

Instantly share code, notes, and snippets.

@robdodson
Created February 17, 2017 16:31
Show Gist options
  • Select an option

  • Save robdodson/a3a3339042f3bee81c662e65ac0501d4 to your computer and use it in GitHub Desktop.

Select an option

Save robdodson/a3a3339042f3bee81c662e65ac0501d4 to your computer and use it in GitHub Desktop.
var onload = function() {
// If web components are supported this will fire immediately,
// othewrise it will wait for the polyfills to load.
// Load your components here
var components = document.createElement('script');
script.async = true;
script.src = '../dist/page-sections.js';
document.head.appendChild(components);
};
var webComponentsSupported = (
'registerElement' in document
);
if (!webComponentsSupported) {
var script = document.createElement('script');
script.async = true;
script.src = '/bower_components/webcomponentsjs/webcomponents-lite.min.js';
script.onload = onload;
document.head.appendChild(script);
} else {
onload();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment