Created
January 16, 2020 15:37
-
-
Save pravdomil/393bcca7b4bc03b90c4230db674f5e5a to your computer and use it in GitHub Desktop.
for Elm
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
try { | |
main() | |
} catch (e) { | |
document.body.textContent = "" | |
create(document.body, "h1", "m-3").textContent = "😔" | |
create(document.body, "pre", "m-3").textContent = e | |
throw e | |
} | |
function main() { | |
const node = create(document.body, "div") | |
const app = Elm.Main.init({ node: node, flags: {} }) | |
} | |
function create(parent, type, className) { | |
const el = document.createElement(type) | |
if (parent) parent.appendChild(el) | |
if (className) el.className = className | |
return el | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment