33 * and data binding capabilities.
44 */
55export default class ZephyrJS extends HTMLElement {
6- static baseUrl = '' ;
6+ static baseUrl = 'https://cdn.jsdelivr.net/gh/RPDevJesco/ZephyrJS@0.15/' ;
7+
8+ /**
9+ * Sets the base URL for loading templates.
10+ * If a CDN link is provided, it is used as is.
11+ * If a relative path is provided, it's treated as a local path.
12+ */
13+ static setBaseURL ( url ) {
14+ if ( url . startsWith ( 'http' ) ) {
15+ // CDN or full URL
16+ ZephyrJS . baseUrl = url . endsWith ( '/' ) ? url : url + '/' ;
17+ } else {
18+ // Local relative path
19+ ZephyrJS . baseUrl = new URL ( url , window . location . origin ) . href ;
20+ }
21+ }
722
823 /**
924 * Initializes the custom element, sets up shadow DOM, state management, and data bindings.
@@ -311,19 +326,4 @@ function defineCustomElement(name, elementClass) {
311326 customElements . define ( name , elementClass ) ; // Register the custom element with the browser
312327}
313328
314- /**
315- * Sets the base URL for loading templates.
316- * If a CDN link is provided, it is used as is.
317- * If a relative path is provided, it's treated as a local path.
318- */
319- export function setBaseURL ( url ) {
320- if ( url . startsWith ( 'http' ) ) {
321- // CDN or full URL
322- ZephyrJS . baseUrl = url . endsWith ( '/' ) ? url : url + '/' ;
323- } else {
324- // Local relative path
325- ZephyrJS . baseUrl = new URL ( url , window . location . origin ) . href ;
326- }
327- }
328-
329329export { ZephyrJS , defineCustomElement } ; // Export the CustomElement class and defineCustomElement function
0 commit comments