mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 01:41:13 +08:00
19 lines
467 B
JavaScript
19 lines
467 B
JavaScript
/**
|
|
* getStaticConfiguration will return a singleton of the static configuration
|
|
* object provided via a JSON DOM element.
|
|
*/
|
|
let staticConfiguration = null;
|
|
export const getStaticConfiguration = () => {
|
|
if (staticConfiguration != null) {
|
|
return staticConfiguration;
|
|
}
|
|
|
|
const configElement = document.querySelector('#data');
|
|
|
|
staticConfiguration = JSON.parse(
|
|
configElement ? configElement.textContent : '{}'
|
|
);
|
|
|
|
return staticConfiguration;
|
|
};
|