New syntax for r.connect in JavaScript

@coffeemug -- can you take a look at this pull request?