javascript pseudo events pub/sub