A helper for creating nicely chained Javascript interfaces