Webview::Window
Inherits Reference / Object
A webview window.
To use webview.cr, inherit this class and overload the #run method.
class MyWindow < Webview::Window
def run
run do
go_to "https://crystal-lang.org"
end
end
end
Constants
Constructors
Instance methods
navigate to the given URL. This is equivalent to calling
window.location = url in Javascript.
Set the maximum size the window can be resized to.
Set the minimum size the window can be resized to.
Render the received HTML page.
This is the same as #location= with a URL that starts with "data:text/html,"
Render the received plaintext
This is the same as #location= with a URL that starts with "data:text/text,"
Overload this as the entrypoint of your application, and call run from
inside, setting up the webview in the block.
def run
run do
go_to "https://example.com"
end
end
This must return a string which is valid javascript, which will be executed each
time a new page is loaded. It is guaranteed that code is executed before
window.onload.
By default (as in, unless the class is inherited and the method
overloaded), this is nil, and no code is injected.