site: make main REPL use relaxed sandbox when loading from example

pull/2279/head
Conduitry 7 years ago
parent 665c3eac79
commit a0e6638a96

@ -23,6 +23,7 @@
let gist; let gist;
let name = 'loading...'; let name = 'loading...';
let zen_mode = false; let zen_mode = false;
let relaxed = false;
$: if (typeof history !== 'undefined') { $: if (typeof history !== 'undefined') {
const params = []; const params = [];
@ -48,6 +49,7 @@
} }
if (gist_id) { if (gist_id) {
relaxed = false;
fetch(`gist/${gist_id}`).then(r => r.json()).then(data => { fetch(`gist/${gist_id}`).then(r => r.json()).then(data => {
gist = data; gist = data;
const { id, description, files } = data; const { id, description, files } = data;
@ -88,6 +90,7 @@
function load_example(slug) { function load_example(slug) {
console.log(`loading ${slug}`); console.log(`loading ${slug}`);
relaxed = true;
fetch(`examples/${slug}.json`).then(async response => { fetch(`examples/${slug}.json`).then(async response => {
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
@ -171,6 +174,6 @@
/> />
{#if process.browser} {#if process.browser}
<Repl bind:this={repl} {version}/> <Repl bind:this={repl} {version} {relaxed}/>
{/if} {/if}
</div> </div>

Loading…
Cancel
Save