Skip to content

Commit a3dd6d6

Browse files
committed
updates to zephr.js. Updated way that the base URL is handled.
1 parent 57bfc7a commit a3dd6d6

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

zephyrcore/zephyr.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@
33
* and data binding capabilities.
44
*/
55
export 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-
329329
export { ZephyrJS, defineCustomElement }; // Export the CustomElement class and defineCustomElement function

zephyrtemplates/ZephyrCore.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export function setTheme(themeName) {
3131
// Expose setTheme to the global scope
3232
window.Themes = Themes;
3333
window.setTheme = setTheme;
34-
window.setBaseURL = ZephyrJS.setBaseURL;
3534

3635
import BasicCard from "../zephyrtemplates/BasicCard.js";
3736
import LayeredCard from "../zephyrtemplates/LayeredCard.js";

0 commit comments

Comments
 (0)