JavaScript Pub/Sub dispatcher with event filtering