Ruby <-> Javascript Bridge

Moderator: Jim

Ruby <-> Javascript Bridge

Postby Jim » Sat Jun 20, 2009 7:00 pm

Quoted from this thread.

ScottLininger wrote:
On the WebDialog topic...

We wrote a somewhat generic bridge between JS and Ruby that we used for Dynamic Components. I learned a lot from that and would have some thoughts on how to build a new one that's truly generic and easy to use. That's almost worthy of its own big thread. ;)

One note: I think it would be work for the JS code side of a bridge to be stored in the ruby and then dumped into the WebDialog via execute_script, so JS code side of things would call something like this:

Code: Select all
window.location.href='skp:initialize_bridge';


...and then from there would have access to whatever JS methods we implement.


Scott,

Would it possible to give a brief overview of design?
0
Hi

Jim 
Global Moderator
 

Re: Ruby <-> Javascript Bridge

Postby thomthom » Sat Jun 20, 2009 7:15 pm

I was previously talking to Brad on the topic of JSON bridge between SU and webdialogs. I didn't have the opportunity to look further into it. But I wonder what we ended up with.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Ruby <-> Javascript Bridge

Postby Chris Fullmer » Sat Jun 20, 2009 7:16 pm

I have nearly found myself at a complete standstill because I don't have any JS, CSS, HTML experience.

Anything that could be done to help bridge the gap would be absolutely wonderful!

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: Ruby <-> Javascript Bridge

Postby chrisglasier » Sun Jun 21, 2009 5:23 am

Chris Fullmer wrote:I have nearly found myself at a complete standstill because I don't have any JS, CSS, HTML experience.

Anything that could be done to help bridge the gap would be absolutely wonderful!

Chris


Not exactly wonderful and in need of improvement but you could have a look at the cgScenes files if you want. I use concatenated functions names - deviceAspectAction (e.g. sceneLayoutToggle) in both js and ruby so you can see the semantic links (bridge if you like). Here's the latest version being used for tesing Mac compatibility -
cgScenes R1.033(white version with start).zip
.

Cheers

Chris
0
With JSON machines we can analyse what is to be achieved so that IT can help with automation to achieve it.
User avatar
chrisglasier 
PluginStore Author
PluginStore Author
 

Re: Ruby <-> Javascript Bridge

Postby Jim » Sun Jun 21, 2009 4:42 pm

Here is a good write-up by Fedo6 of some of the Mac issues.

viewtopic.php?f=180&t=13394&p=101428
0
Hi

Jim 
Global Moderator
 

Re: Ruby <-> Javascript Bridge

Postby thomthom » Sun Jun 21, 2009 5:26 pm

I wish that the SU had used the Mozilla Engine, that would have worked on Mac and PC.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Ruby <-> Javascript Bridge

Postby Jim » Sun Jun 21, 2009 6:14 pm

My understanding is that the interaction between Ruby & Javascript works as designed only on Windows, and not on the Mac.

Does this imply a goal of making the Mac platform behave like the Windows platform?
0
Hi

Jim 
Global Moderator
 

Re: Ruby <-> Javascript Bridge

Postby RickW » Wed Jun 24, 2009 4:35 pm

I've successfully run Windowizer4 on Mac, and the W4 WebDialog uses the Ruby/JS interaction. However, ImageProfile still fails, also using WebDialogs and Ruby/JS interaction.

There are also other issues with the Mac Ruby implementation besides just the Ruby/JS interaction. For example, calling eval() inside a class will behave differently on Mac than PC if the expression creates a class or method.
0

RickW 
 

Re: Ruby <-> Javascript Bridge

Postby chrisglasier » Wed Jun 24, 2009 11:44 pm

RickW wrote:I've successfully run Windowizer4 on Mac, and the W4 WebDialog uses the Ruby/JS interaction. However, ImageProfile still fails, also using WebDialogs and Ruby/JS interaction.

There are also other issues with the Mac Ruby implementation besides just the Ruby/JS interaction. For example, calling eval() inside a class will behave differently on Mac than PC if the expression creates a class or method.


Please see what I believe initiated this thread. I have nearly completed what I said there about interacting in chains (don't know technical term) but ...

I don't have a Mac and I have no idea whether it will work or what will come up next.

Do you think I should give up and state cgScenes is only for PC? Seems very wimpish.

Chris
0
With JSON machines we can analyse what is to be achieved so that IT can help with automation to achieve it.
User avatar
chrisglasier 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Skx Extension Library

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: