easyappointments/application/views/components/js_vars_script.php

20 lines
343 B
PHP
Raw Normal View History

<?php
/**
* @var string $attributes
*/
?>
<script <?= $attributes ?>>
window.vars = (function () {
const vars = <?= json_encode(script_vars()) ?>;
return (key) => {
if (!key) {
return vars;
}
return vars[key] || undefined;
};
})();
</script>