I have a piece of code i haven been written, And i don't understand why its not working
I have written:
public class MyUtility {
public static int computeLoanInterest(int amt, float interestRate, int term) {
return (amt*term);
}
public static native void exportStaticMethod() /*-{
$wnd.computeLoanInterest =
$entry(@com.myapp.appname.client.MyUtility::computeLoanInterest(IFI));
}-*/;
}
on my client java entrypoint:
public void onModuleLoad() {
MyUtility.exportStaticMethod();
}
and on my handwritten javascript code:
<head>
<script type="text/javascript" language="javascript" src="projv1/projv1.nocache.js"></script>
<script type="text/javascript">
function mainl(){
var it=window.computeLoanInterest(5,2,2);
alert(it);
}
</script>
</head>
<body onload="mainl()">
</body>
but i'm getting an error on the console of the browser:
Uncaught TypeError: undefined is not a function