Created
June 11, 2018 04:41
-
-
Save lazyhacker/bfc97fefbbb270cdee53b38a85925d48 to your computer and use it in GitHub Desktop.
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
func cbRunIvy(e js.Value) { | |
window := browser.GetWindow() | |
if e.Get("keyCode").Int() == 13 { | |
express := window.Document.GetElementById("expression") | |
expr := express.Value() | |
res, err := mobile.Eval(expr) | |
if err != nil { | |
window.Console.Warn(err.Error()) | |
return | |
} | |
element := window.Document.GetElementById("ivy-out") | |
content := element.InnerHTML() | |
element.SetInnerHTML(content + "> " + expr + "<br/>" + res + "<br/>") | |
express.SetValue("") | |
window.ScrollTo(0, window.InnerHeight()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment