Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created April 1, 2018 13:42
Show Gist options
  • Save lmiller1990/825f7483124ff477b8e9b903eeb667b5 to your computer and use it in GitHub Desktop.
Save lmiller1990/825f7483124ff477b8e9b903eeb667b5 to your computer and use it in GitHub Desktop.
const qs = el => document.querySelector(el)
const evt = (el, evtType, cb) => el.addEventListener(evtType, cb)
const val = el => qs(el).value.trim()
const greet = () => console.log('greet')
// const p = () => new Promise(res => res('ok'))
function exec() {
const source = val('#source')
new Function(source)()
}
document.addEventListener('DOMContentLoaded', () => {
// evt(qs('#el'), 'click', () => console.log('ok'))
evt(qs('#compile'), 'click', exec)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment