Created
May 18, 2016 13:48
-
-
Save teggr/ba5a210c7ca3dd936245617a3afdfa08 to your computer and use it in GitHub Desktop.
javapoly.js example
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
<html> | |
<head> | |
<!-- Include the Polyfill --> | |
<script type="text/javascript" src="https://www.javapoly.com/javapoly.js"></script> | |
<!-- Invoke your Java code from Javascript --> | |
<script type="text/java"> | |
package com.javapoly.demo; | |
import com.javapoly.dom.Window; | |
public class Greeter | |
{ | |
public static void sayHello(String name) | |
{ | |
Window.alert("Hello " + name + ", from Java!"); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<!-- Invoke your Java code from Javascript --> | |
<script type="text/javascript"> | |
JavaPoly.type('com.javapoly.demo.Greeter') | |
.then(function(greeter){ | |
greeter.sayHello('you dirty dog'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment