simple implementation of messenger pattern in js for demo purposes