Javascript dependency injector / event binder