<p dir="ltr">+1 ;-)</p>
<div class="gmail_quote">Em 28/02/2014 13:59, &quot;Erik Jan de Wit&quot; &lt;<a href="mailto:edewit@redhat.com">edewit@redhat.com</a>&gt; escreveu:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><blockquote type="cite"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
I like this better as well, verse having to put in a if then else block based on mobile OS, which is error prone.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
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.  :-)</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
How else could the block above be written to look more &quot;straightforward&quot;?   keeping in mind that our average user is a Struts/SpringMVC kind of developer.</div></blockquote></div><div><br></div>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<br>
<div><pre style="margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(221,221,221);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;line-height:19px;font-size:13px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;color:rgb(51,51,51)">
<pre style="color:rgb(0,0,0);font-size:12px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;line-height:16.799999237060547px;width:744px;margin-top:0px;margin-bottom:0px;padding:0px;background-color:rgb(255,255,255)">
<div><div><span style="color:rgb(51,51,51);font-size:13px;line-height:19px;font-weight:bold">var</span><span style="background-color:rgb(248,248,248);color:rgb(51,51,51);font-size:13px;line-height:19px"> </span><span style="color:rgb(51,51,51);font-size:13px;line-height:19px">pushConfig</span><span style="background-color:rgb(248,248,248);color:rgb(51,51,51);font-size:13px;line-height:19px"> </span><span style="color:rgb(51,51,51);font-size:13px;line-height:19px;font-weight:bold">= </span><span style="line-height:16.799999237060547px">{</span></div>
<div>    pushServerURL<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;pushServerURL e.g http(s)//host:port/context &gt;&quot;</span>,</div></div><div>    alias<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;alias e.g. a username or an email address optional&gt;&quot;</span>,</div>
<div>    android<span style="font-weight:bold">:</span> {</div><div>      senderID<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;senderID e.g Google Project ID only for android&gt;&quot;</span>,</div>
<div><div>      variantID<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;variantID e.g. 1234456-234320&gt;&quot;</span>,</div><div>      variantSecret<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;variantSecret e.g. 1234456-234320&gt;&quot;</span></div>
</div><div>    },</div><div>    ios<span style="font-weight:bold">:</span> {</div><div><div>      variantID<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;variantID e.g. 1234456-234320&gt;&quot;</span>,</div>
<div>      variantSecret<span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">&quot;&lt;variantSecret e.g. 1234456-234320&gt;&quot;</span></div><div>    }</div></div><div>};</div><div><br></div><div><pre style="line-height:16.799999237060547px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;width:744px;margin-top:0px;margin-bottom:0px;padding:0px">
<div><span>push</span><span>.</span><span>register</span><span>(</span><span style="line-height:16.799999237060547px">onNotification</span><span style="line-height:16.799999237060547px">,</span><span style="line-height:16.799999237060547px"> </span><span style="line-height:16.799999237060547px">errorHandler, pushConfig</span><span style="line-height:16.799999237060547px">);</span></div>
<div><span style="line-height:16.799999237060547px"><br></span></div><div><pre style="line-height:16.799999237060547px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;width:744px;margin-top:0px;margin-bottom:0px;padding:0px">
<div><span style="font-weight:bold">function </span><span>onNotification</span><span>(</span><span>event</span><span>)</span> <span>{</span></div><div>  <span>alert</span><span>(</span><span>event</span><span>.</span><span>alert</span><span>);</span></div>
<div><span>}</span></div><div><span><br></span></div><div><span style="font-weight:bold">function </span><span>errorHandler</span><span>(</span><span>error</span><span>)</span> <span>{</span></div><div>  <span style="font-weight:bold">throw</span> <span>error</span><span>;</span></div>
<div><span>}</span></div></pre><div><br></div></div></pre></div></pre></pre></div><div><span><br></span></div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div>