cache gist by default for faster eval

This commit is contained in:
Felix Roos 2022-06-18 23:06:21 +02:00
parent 774c02afab
commit ecd93c9a92
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
// this is a shortcut to eval code from a gist
// why? to be able to shorten strudel code + e.g. be able to change instruments after links have been generated
export default (route) =>
fetch(`https://gist.githubusercontent.com/${route}?cachebust=${Date.now()}`)
export default (route, cache = true) =>
fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache ? '' : Date.now()}`)
.then((res) => res.text())
.then((code) => eval(code));

View File

@ -15,5 +15,5 @@ export * from './state.mjs';
export * from './timespan.mjs';
export * from './util.mjs';
export * from './speak.mjs';
export * as gist from './gist.js';
export { default as gist } from './gist.js';
// export * from './value.mjs';