implemented Rust->JS messaging

Messaging was missing, would you implement it like this? My editor removed a few trailing spaces.