Building a javascript framework