First release
This commit is contained in:
14
html/static/js/templates/templates.js
Normal file
14
html/static/js/templates/templates.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import {AsyncValueCache} from "../avc/avc.js"
|
||||
|
||||
const tc = new AsyncValueCache(true, () => {
|
||||
return fetch("/api/templates").then(res => res.json()).then(data => {
|
||||
Object.keys(data).forEach(key => {
|
||||
let fn = Function(data[key] + "; return template")()
|
||||
data[key] = fn
|
||||
})
|
||||
console.log(`Loaded ${Object.keys(data).length} templates`)
|
||||
return data
|
||||
})
|
||||
})
|
||||
|
||||
export {tc}
|
||||
Reference in New Issue
Block a user