how to update thebelab configuration dynamically
I've got a site (jupyter-book) that uses Turbolinks to cache pages. One challenge this has brought up is that if any pages have a different thebelab configuration, these won't be re-loaded upon a new page load since they're baked into the cache of the page. It'd be straightforward if I could dynamically update the thebelab configuration in javascript in order to check for this...is there some way to do this?
If you call thebelab.bootstrap({options}), it should load those options over whatever it finds on the page. Does that work in your context?
To implement this assuming you've used the <script type="text/x-thebe-config"> tags for config:
var configText = document.querySelector("script[type='text/x-thebe-config']").textContent;
var thebeConfig = eval(`(${configText})`);
thebelab.bootstrap(thebeConfig);
Alternately, create the options dict directly in a js variable and call thebelab.bootstrap(options)
@choldgraf do you have a link to the site?
ah hah, that's good to know @minrk ! So if I just call bootstrap passing the configuration each time, it'll have the same behavior. Very cool. Maybe we should keep this open as a documentation improvement?
@akhmerov here ya go! https://jupyter.org/jupyter-book