1234567891011121314151617181920212223242526 |
- /**
- * ModuleLoader.js
- *
- * @author realor
- */
- class ModuleLoader {
- static load(path) {
- let fullPath
- if (path.startsWith('http:') || path.startsWith('https:')) {
- fullPath = path
- } else {
- let pathname = window.location.pathname
- let index = pathname.lastIndexOf('/')
- let basePath = pathname.substring(0, index) //+ '/js/'
- if (path.indexOf('/js/') == -1) {
- fullPath = basePath + '/js/' + path
- } else {
- fullPath = basePath + path
- }
- }
- return import(fullPath)
- }
- }
- export { ModuleLoader }
|