window.onload = function () { let editor; let iframe; let selected; window.showExample = async (id) => { if (selected) { selected.classList.remove('selected'); } selected = document.getElementById(`example-${id}`); selected.classList.add('selected'); const code = await fetch(`samples/${id}.js`).then((res) => res.text()); editor.setValue(code); runLiveExample(code); }; document .getElementById('refresh') .addEventListener( 'click', () => runLiveExample(editor.getValue()), false ); window.runLiveExample = (code) => { if (iframe) { iframe.parentNode.removeChild(iframe); } iframe = document.createElement('iframe'); iframe.srcdoc = `

Our Coffee SDK Example Application