* @param callback A method to call when the "load" event fires.
*/
private static void addLoadListener(final JavaScriptObject jsoPeer,
final DirectionsCallback callback) {
EventImpl.impl.addListenerVoid(jsoPeer, MapEvent.LOAD, new VoidCallback() {
@Override
public void callback() {
int statusCode = DirectionsImpl.impl.getStatusCode(jsoPeer);
if (statusCode == StatusCodes.SUCCESS) {
DirectionResults result = new DirectionResults(jsoPeer);
callback.onSuccess(result);
} else {
callback.onFailure(statusCode);
}
}
});
EventImpl.impl.addListenerVoid(jsoPeer, MapEvent.ERROR, new VoidCallback() {
@Override
public void callback() {
int statusCode = DirectionsImpl.impl.getStatusCode(jsoPeer);
callback.onFailure(statusCode);
}