<div dir="ltr"><div>looks great</div><div><br></div><div>+1 for using some conventions of npm code styling</div><br><div><div>It would be nice to follow one more npm-code-style convention about callbacks, which says that the callback is always the last argument in the list. It will be easier for users to use our API and it improves consistency.</div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-27 17:27 GMT+03:00 Lucas Holmquist <span dir="ltr">&lt;<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px;margin-top:0px!important">
Last week i decided to start playing around with converting the AeroGear.js Pipeline library to run in node.js</p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">
I thought this would be a good place to start when thinking about how ES6 modules work, and how the code would need to be structured.</p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">
This is no doubt a WIP, but have a look see here:</p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px"><a href="https://github.com/lholmquist/aerogear-pipeline" rel="noreferrer" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://github.com/lholmquist/aerogear-pipeline</a></p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px"><em>currently it only deals in JSON</em></p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">
For usage checkout the tests. The Usage should be similar but since this is node.js, i’m following some of their conventions for how they do callbacks. The convention is to have a callback where the first argument is the err</p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">an example read:</p><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:13px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(221,221,221);line-height:19px;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;color:rgb(51,51,51);background-color:rgb(248,248,248)">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;margin:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;padding:0px;word-wrap:normal;display:inline;line-height:inherit;background-color:transparent;background-repeat:initial initial">pipe.read({ id: 1 }, function(err, data, response) {
});
</code></pre><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">or to read all</p><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:13px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(221,221,221);line-height:19px;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;color:rgb(51,51,51);background-color:rgb(248,248,248)">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;margin:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;padding:0px;word-wrap:normal;display:inline;line-height:inherit;background-color:transparent;background-repeat:initial initial">pipe.read(function (err, data, response) {
});
</code></pre><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">and since this is just wrapping a <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;margin:0px;border:1px solid rgb(221,221,221);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;padding:0px;background-color:rgb(248,248,248)">http.request</code>, it will also emit any events the <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;margin:0px;border:1px solid rgb(221,221,221);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;padding:0px;background-color:rgb(248,248,248)">http.request</code> emits</p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px"><em>For those wondering about my code style here, i’ve adapted the style from the yeoman project, with 1 difference, 4 spaces instead of 2</em></p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">I&#39;m not sure what part of the library could be next, datamanager might not make sense here since there is no &quot;client side&quot; storage per say.</p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">I have a WIP implentation of a SimplePush client here: <a href="https://github.com/lholmquist/aerogear-simplepush-node-client" rel="noreferrer" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://github.com/lholmquist/aerogear-simplepush-node-client</a></p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15px;line-height:25.5px">Thoughts?</p></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><br></div>