Created
April 1, 2018 13:42
-
-
Save lmiller1990/825f7483124ff477b8e9b903eeb667b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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