diff --git a/src/config.mjs b/src/config.mjs new file mode 100644 index 0000000..03d2ee2 --- /dev/null +++ b/src/config.mjs @@ -0,0 +1,22 @@ +/** + * Get configuration from the given location. + * + * @param location {Location} The location to use to determine the configuration. + * @returns {{file: string, vault: string}} + */ +export function configFromURL(location) { + const queryString = new URLSearchParams(location.search) + const vault = queryString.get("vault") + const file = queryString.get("file") + + return {vault, file} +} + +/** + * Get configuration from the current {@link window.location}. + * + * @returns {{file: string, vault: string}} + */ +export function configFromWindow() { + return configFromURL(window.location) +} diff --git a/src/index.mjs b/src/index.mjs new file mode 100644 index 0000000..d81e6ef --- /dev/null +++ b/src/index.mjs @@ -0,0 +1 @@ +import {} from "./config.mjs"