What I don't understand is why onload and onerror need a return value?  I 
just return null as I've no clue what the return value should be.


Because these on<Event> properties and their functions are defined that 
way. For example in the old days you could return false in an onclick 
function to suppress the click default action of the browser. These days it 
is recommended to always use addEventListener() instead of these event 
properties and to suppress the default action you call 
event.preventDefault().

Also in JS a function basically always have some return value, e.g.

function() {
  return;
  return undefined;
  // no return statement at all
}

is all the same and returns undefined. That is why Promises in elemental2 
also feel a bit clunky compared to JS. Promises allow you to return a new 
Promise/thenable in your success/catch callback methods so elemental2 has 
to define a return type for these callback functions. If you do not want to 
return a Promise/thenable in JS then you simply do not write a return 
statement but in Java you now have to write return null.

-- J. 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/4a755a9a-a509-4003-b0af-82c8f4a385edn%40googlegroups.com.

Reply via email to