Basic javascript IoC