Node Roundup: Node 0.4.3, npm 1.0, Geo, MicroEvent
Node 0.4.3
Node 0.4.3 is out, which has some interesting changes:
- Start up memory footprint improvement
- HTTP Agent bugs
- Upgrade V8 to 3.1.8.3
npm 1.0
Isaac Schlueter has been working on npm 1.0, and I noticed he’s written an interesting about about 1.0’s ls command for the Node blog: npm 1.0: The New ls. It’s now at release candidate stage, and there’s a lot of activity going on over at isaacs/npm on GitHub.
Geo
Geo for Node.js (GitHub: feliperazeek/geonode) by Felipe Oliveira is a geocoding library that uses Google’s Geocode API for geocoding, and GeoHash for GeoSpatial support.
var geo = require('geo'),
sensor = false,
address = '221B Baker Street, London, UK';
geo.geocoder(geo.google, address, sensor, function(formattedAddress, latitude, longitude) {
console.log("Formatted Address: " + formattedAddress);
console.log("Latitude: " + latitude);
console.log("Longitude: " + longitude);
});
// Output:
// Formatted Address: 221 Baker St, Paddington, Greater London NW1 5, UK
// Latitude: 51.5231225
// Longitude: -0.1580078
Seems incredibly useful to me, assuming Google’s terms let us use this for something interesting!
MicroEvent.js
MicroEvent.js by Jerome Etienne (GitHub: jeromeetienne / microevent.js) is a tiny event emitter library for client-side code and Node. It uses the observer pattern, like this:
var Ticker = function() {
var self = this;
setInterval(function() {
// 'trigger' is provided by MicroEvent
self.trigger('tick', new Date());
}, 1000);
};
// You have to use this method to make your class MicroEvent-enabled:
MicroEvent.mixin(Ticker);
var ticker = new Ticker();
// Now we can observe when the event fires
ticker.bind('tick', function(date) {
console.log('notified date', date);
});
