Skip to content

Instantly share code, notes, and snippets.

@libliflin
Last active September 15, 2017 04:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save libliflin/1a32d79048774ff304a3 to your computer and use it in GitHub Desktop.
Save libliflin/1a32d79048774ff304a3 to your computer and use it in GitHub Desktop.
Skip opening devtools when programming mithril
/*
error method makes it so i don't have to open up dev tools to see what went wrong.
must be in different <script> from your app code.
I use it in combination with Auto Reload https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api
*/
window.onerror = function(msg, url, line, col, error) {
m.render(document,
m("html", [
m("body", [
m("table", [
m("tr", [
m("td", "url"),
m("td", url)
]),
m("tr", [
m("td", "Message"),
m("td", msg)
]),
m("tr", [
m("td", "Line number"),
m("td", line)
]),
m("tr", [
m("td", "Column"),
m("td", col)
]),
m("tr", [
m("td", "Error"),
m("td", error)
])
])
])
])
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment