Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def expanded
@para = para(
"'Scarpe' means shoes in Italian. 'Scarpe' also means Shoes in modern Ruby and webview!</br>",
"Scarpe isn't feature complete with any version of Shoes (yet?). We're initially targeting Shoes Classic. ",
link("Learn more", click: "http://github.com/schwad/scarpe"),
link("Learn more", click: -> { navigate_to("http://github.com/schwad/scarpe") }), # Update this line
" ",
link("(show less)") { @para.destroy; @para = collapsed }
)
Expand Down
7 changes: 7 additions & 0 deletions lib/scarpe/wv/web_wrangler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def initialize(title:, width:, height:, resizable: false, heartbeat: 0.1)

@dom_wrangler = DOMWrangler.new(self)

bind("navigate_to") do |url|
navigate_to(url)
end

bind("puts") do |*args|
puts(*args)
end
Expand Down Expand Up @@ -365,6 +369,9 @@ def time_out_eval_results

attr_writer :empty_page

def navigate_to(url)
@webview.navigate(url)
end
# After setup, we call run to go to "running" mode.
# No more setup callbacks should be called, only running callbacks.
def run
Expand Down
Loading