Improved javascript component "API"