Created
October 3, 2017 09:34
-
-
Save abdheshkumar/f2ef0c73b942a8f5a48ec20559679105 to your computer and use it in GitHub Desktop.
Object-Function
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
Html: | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | |
<script type="text/javascript"> | |
Office = { | |
initialize: function (reason) { | |
$(document).ready(function () { | |
reason("Message from Javascript"); | |
//Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, callbackfunction); | |
}); | |
} | |
}; | |
</script> | |
</head> | |
<body> | |
<script type="text/javascript" src="target/scala-2.12/cross-project-test-fastopt.js"></script> | |
</body> | |
</html> | |
ScalaJs: | |
object Main { | |
@js.native | |
@JSGlobal("Office") | |
object Office extends js.Any { | |
def initialize(f: js.Function1[String,Unit]):js.Any = js.native | |
} | |
def callback = (reason:String) => { | |
println(s"reason called in callback function => $reason") | |
} | |
def main(args: Array[String]): Unit = { | |
Office.initialize(callback) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment