UNPKG

cor-lang

Version:
47 lines (37 loc) 1.05 kB
(function(cor){ var loader = cor.loader = new cor.Loader(), path = cor.path; isBooted = false; function bootApp() { if (isBooted) { return; } isBooted = true; var entry, conf, scripts = document.getElementsByTagName('script'), len = scripts.length, i = -1; while (++i < len) { entry = entry || scripts[i].getAttribute('data-entry'); conf = conf || scripts[i].getAttribute('data-conf'); } loader.setEntry(path.sanitize(entry || ''), path.sanitize(conf || '')); } if (cor.isBrowser) { if (document.readyState === 'complete') { bootApp(); } else { if (document.addEventListener) { document.addEventListener('DOMContentLoaded', bootApp, false); window.addEventListener('load', bootApp, false); } else { document.attachEvent('onreadystatechange', bootApp); window.attachEvent('onload', bootApp); } } } })(typeof cor === 'undefined' ? {} : cor);