Created
February 8, 2017 02:23
-
-
Save me7/3d09a3da818093a3a26892b53613e355 to your computer and use it in GitHub Desktop.
Inject mithril to webpage
This file contains 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
//press F12 to open chrome dev tools | |
//then add mithril to header | |
var mt = document.createElement('script'); | |
mt.src = "https://unpkg.com/mithril/mithril.js"; | |
document.getElementsByTagName('head')[0].appendChild(mt); | |
//test render | |
m.render(document.body,"Hello"); | |
//let create link and click | |
m.render(document.body,m("a#link",{href:"https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/02/1454335918es6-arrow-functions-new-fat-and-concise-syntax-in-js05-no-parameters.png"},"click")) | |
var l = document.getElementById("link") | |
l.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment