Synchronous Ruby calls from Safari?
Synchronous Ruby calls from Safari?
- Subject: Synchronous Ruby calls from Safari?
- From: "David Springer" <email@hidden>
- Date: Wed, 19 Mar 2008 18:33:32 -0600
All,
The attached html/Javascript and Ruby scripts run differently on a PC
with IE than they do no a Mac with Safari. On IE, the alert panels
pop up in sequence; as if the Ruby call is synchronous. On the Mac,
the last alert pops up before the third alert, or simultaneously with
it. I did some debugging in my WebKit objects, and it looks like the
notifications which get the Ruby script to execute are called after a
spin through the event loop, after the end of the Javascript block
that calls Ruby.
My question is, is there a way to make the call through to Ruby
"synchronous" so that it works like it does on IE? Is there a switch
I can set in my WebKit objects, or some way I can fake this behavior?
Thanks,
- Dave.S
# Create the WebDialog instance
my_dialog = UI::WebDialog.new("Dialog", false, "Dialog", 400, 600, 100, 100, true)
# Attach an action callback
my_dialog.add_action_callback("call_ruby") do |web_dialog,command|
UI.messagebox('3) Ruby says: "I\'ve received a callback, and I\'m setting a javascript variable called returnValue to 5"')
web_dialog.execute_script("top.returnValue=5")
end
html_path = Sketchup.find_support_file("macAsyncScriptBug.html" ,"Plugins")
my_dialog.set_file html_path
my_dialog.show_modal()
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden