JS-Signals: Custom event/messaging system for JavaScript

I’ve just released a new open source project called JS-Signals. It’s an event/message system similar to pub/sub and DOM2 Events but that doesn’t rely on strings to broadcast/subscribe to events, it has also some extra features that usually aren’t available on the other systems.

JS-Signals was heavily inspired by Robert Penner’s AS3-Signals but it is NOT a direct port, which means it has a different implementation and features. I’ve also stolen borrowed a few ideas from Joa Ebert fork ;).

Make sure you read the comparison between the different event systems and the usage examples.

Download it and get more info at http://millermedeiros.github.com/js-signals/.

Ideas and contributors are welcome!


zepto.js and mobile JavaScript

Ok, I know that writing this post is probably a bad idea but I will do it anyway, please note that this is my personal opinion and not from any company/client I work or worked for and that I respect other people’s opinions (that doesn’t mean I agree with them), I know that some things I’m going to write are going to sound arrogant and that some people are going to get it wrong… please try to keep your emotions aside and think rationally before getting into a conclusion and read the about page to understand the objective of this blog. I don’t want to start a flame war and remember that every person/project has different needs, my perspective and the kind of stuff I’m currently building may be completely different from your needs/desires/preferences… Having that said….

Starting from the beginning

I had plans to do something similar for while, was just starting a new mobile project that would require some basic JavaScript and since I saw that Thomas Fuchs was starting to do it too I thought that “combining forces” we could build something better and I would spend less time on it, specially since everything he does get some pretty big attention on the JS community, which means more people to help.. (since time is a really scarce resource nowadays)
Read more…


Canvas Method Chaining

This week I’ve done some stuff using the HTML5 canvas and one feature that I kind missed was method chaining, so I decided to implement it…

It isn’t something ground-breaking - other people done it before (Canto.js, MDC canvas, p01, …) - but I decided to implement it by myself since it’s something simple, the other solutions are way more complex than what I needed, source code isn’t that clean and/or overwrites native objects prototypes (possibly causing conflicts/issues), etc…

I’ve released the code as open source under the WTFPL and it is available on GitHub.

Check the project page on GitHub for more details.

I hope it is useful for someone.

PS: I’m not a big fan of method chaining since code tends to be become “more cryptic” but sometimes it makes sense to use, use it with moderation!


Converting SVG to FIVe3D, Flash Vector Graphics and HTML5 canvas

3d vector tiger

This post is being delayed forever since I was planning to improve my SVG parser but finally I decided to release it since I don’t have plans to work on it anymore.. the basic functionalities are working since July 2009 and I abandoned the project for a while just going back to it a couple months ago when I finally decided to fix a few bugs and add the option to export HTML5 Canvas and Flash AS3 drawing commands… so let’s explain how it all started.
Read more…


PHP < 5.3 – Lazy Singleton Class

I’ve been doing some PHP lately (and liking a lot) and one of the cool features of PHP5 comparing to Actionscript3 is that you can have private constructors, which means that it’s really easy to create “real static classes” and singletons without hacks!
Read more…