Javascript Pub/Sub implementation with plain javascript