I'm writing a web app in Dart, I'd like to be able to use it inside a
Google+ Hangout too. It seems that the Hangouts API is specified with
a Javascript interface, with no RESTFUL web API available. Here's the
link:
Is it possible to do this at all with Dart? Reverse engineering the
interface from the js file would probably take too long for it to be
feasible, especially with a moving target. If I really wanted to be
able to use it as a Google+ Hangouts app, then I would have to go back
to js which is something that I really don't want to do.
Our JS interop story is still in flux so there aren't any easy answers here. I think what you could do is write most of your app in Dart. Then write a (hopefully small) shim layer in JS that talks to the Hangouts API and routes it through postMessage(). You can then pick that up in Dart and take it from there.
At least I *think* that's the way you can do it. This isn't my area of expertise.
brendon_dun...@hotmail.co.nz> wrote: > I'm writing a web app in Dart, I'd like to be able to use it inside a > Google+ Hangout too. It seems that the Hangouts API is specified with > a Javascript interface, with no RESTFUL web API available. Here's the > link:
> Is it possible to do this at all with Dart? Reverse engineering the > interface from the js file would probably take too long for it to be > feasible, especially with a moving target. If I really wanted to be > able to use it as a Google+ Hangouts app, then I would have to go back > to js which is something that I really don't want to do.
I've done exactly this when I needed to run some JavaScript code from within Dart. I used postMessage() between Dart and the host page, capturing it in JavaScript. I used this more for course grained signaling, I didn't try to do anything real-time.
On Wed, Feb 29, 2012 at 4:21 PM, Bob Nystrom <rnyst...@google.com> wrote: > Our JS interop story is still in flux so there aren't any easy answers > here. I think what you could do is write most of your app in Dart. Then > write a (hopefully small) shim layer in JS that talks to the Hangouts API > and routes it through postMessage(). You can then pick that up in Dart and > take it from there.
> At least I *think* that's the way you can do it. This isn't my area of > expertise.
> - bob
> On Wed, Feb 29, 2012 at 3:52 PM, Brendon Duncan < > brendon_dun...@hotmail.co.nz> wrote:
>> I'm writing a web app in Dart, I'd like to be able to use it inside a >> Google+ Hangout too. It seems that the Hangouts API is specified with >> a Javascript interface, with no RESTFUL web API available. Here's the >> link:
>> Is it possible to do this at all with Dart? Reverse engineering the >> interface from the js file would probably take too long for it to be >> feasible, especially with a moving target. If I really wanted to be >> able to use it as a Google+ Hangouts app, then I would have to go back >> to js which is something that I really don't want to do.
Yep, as far as I know this is the state of the art.
I forget who had the idea, but we've had discussion about writing an "all-purpose" shim in JS. Handwaving, it would live on the JS side, receive structured strings, and execute the fn calls they specify. Nobody's got concrete plans to write this that I've heard of.
This would not be blindingly fast, but we aren't recommending tight fine-grained intercalling between Dart and JS.
On Wed, Feb 29, 2012 at 4:21 PM, Bob Nystrom <rnyst...@google.com> wrote: > Our JS interop story is still in flux so there aren't any easy answers > here. I think what you could do is write most of your app in Dart. Then > write a (hopefully small) shim layer in JS that talks to the Hangouts API > and routes it through postMessage(). You can then pick that up in Dart and > take it from there.
> At least I *think* that's the way you can do it. This isn't my area of > expertise.
> - bob
> On Wed, Feb 29, 2012 at 3:52 PM, Brendon Duncan < > brendon_dun...@hotmail.co.nz> wrote:
>> I'm writing a web app in Dart, I'd like to be able to use it inside a >> Google+ Hangout too. It seems that the Hangouts API is specified with >> a Javascript interface, with no RESTFUL web API available. Here's the >> link:
>> Is it possible to do this at all with Dart? Reverse engineering the >> interface from the js file would probably take too long for it to be >> feasible, especially with a moving target. If I really wanted to be >> able to use it as a Google+ Hangouts app, then I would have to go back >> to js which is something that I really don't want to do.