wilsonpage/fastdom — pull request #20 by Rich-Harris (2013-10-06 13:04:23+00:00)
Title: use module pattern instead of singleton

This is quite a ballsy pull request, feel free to disregard entirely if you see fit. Basically I wanted to satisfy my own curiosity, and thought I may as well share the result.

I was wondering what the rationale was for using a singleton rather than a module? As a module, all the internal guts (e.g. the unique ID, `_add` and so on) are hidden, and you don't have to create a new `raf(function() { self._frame(); })` for each request when `pending === false`, you can just do `raf(frame)`.

It's about 20% smaller minified (because there are no unmangleable `this` or property names), though gzipped the difference is negligible (a testament to gzip's efficiency).

Anyway as I say I won't be offended if you ignore this PR! Cracking work on the library, I think this will change the way a lot of people approach DOM manipulation.