From ecd93c9a922875f5e6db171a2beddb4de212d5ca Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 18 Jun 2022 23:06:21 +0200 Subject: [PATCH] cache gist by default for faster eval --- packages/core/gist.js | 4 ++-- packages/core/index.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/gist.js b/packages/core/gist.js index 67924762..9df2dda2 100644 --- a/packages/core/gist.js +++ b/packages/core/gist.js @@ -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)); diff --git a/packages/core/index.mjs b/packages/core/index.mjs index 73977401..e64d3215 100644 --- a/packages/core/index.mjs +++ b/packages/core/index.mjs @@ -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';