+1 ;-)

Em 28/02/2014 13:59, "Erik Jan de Wit" <edewit@redhat.com> escreveu:
I like this better as well, verse having to put in a if then else block based on mobile OS, which is error prone.

Question about the JS syntax above - it looks odd to have the configuration object below the function(error), I assume I could have declared the config object above and used it as a parameter to push.register().   When JS gets too creatively away from old school (e.g. Java 1.5) syntax it tends to throw me off.  :-)

How else could the block above be written to look more "straightforward"?   keeping in mind that our average user is a Struts/SpringMVC kind of developer.

Of course we still can make it look like that, this is the same example but then without everything inlined still our average user will have to get used that we are referencing function ‘pointers’ here
var pushConfig = {
pushServerURL: "<pushServerURL e.g http(s)//host:port/context >",
alias: "<alias e.g. a username or an email address optional>",
android: {
senderID: "<senderID e.g Google Project ID only for android>",
variantID: "<variantID e.g. 1234456-234320>",
variantSecret: "<variantSecret e.g. 1234456-234320>"
ios: {
variantID: "<variantID e.g. 1234456-234320>",
variantSecret: "<variantSecret e.g. 1234456-234320>"

push.register(onNotification, errorHandler, pushConfig);

function onNotification(event) {

function errorHandler(error) {
throw error;

aerogear-dev mailing list