1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2025-06-29 08:28:25 +00:00
bibliogram/src/site/html/static/js/templates/templates.js
Cadence Fish eb818bf63d
git subrepo clone /home/cloud/Code/pinski-plugins/templates src/site/html/static/js/templates
subrepo:
  subdir:   "src/site/html/static/js/templates"
  merged:   "a768add"
upstream:
  origin:   "/home/cloud/Code/pinski-plugins/templates"
  branch:   "master"
  commit:   "a768add"
git-subrepo:
  version:  "0.4.0"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "5d6aba9"
2019-12-20 11:43:13 +13:00

15 lines
375 B
JavaScript

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}