Using CustomEvent instead of sendMessage if supported.