A client side implementation of polymorphism in javascript using requirejs