Services

UrlLauncher

UrlLauncher service

Create or retrieve this service with page.url_launcher(**properties). Ruflet reuses the registered service unless you supply a different id.

Example

status = text(value: "Ready to open Ruflet")
page.add(status)
page.launch_url(
  "https://ruflet.dev",
  mode: "externalApplication",
  on_result: ->(opened, error) {
    page.update(status, value: error ? error.to_s : "Opened: #{opened}")
  }
)

Page accessor

  • page.url_launcher(**props)

Properties

  • data — Arbitrary value you can attach to the control and read back in handlers.
  • key — Stable identity used to preserve state across rebuilds.

Page convenience methods

Use these one-shot Page calls when you do not need to keep the service object:

  • page.launch_url(url, mode: ..., web_view_configuration: ..., browser_configuration: ..., web_only_window_name: ..., timeout: ..., on_result: ...)
  • page.can_launch_url(url, timeout: ...)
  • page.close_in_app_web_view(timeout: ..., on_result: ...)
  • page.open_window(url, title: ..., width: ..., height: ..., timeout: ..., on_result: ...)
  • page.supports_launch_mode(mode, timeout: ..., on_result: ...)
  • page.supports_close_for_launch_mode(mode, timeout: ..., on_result: ...)

Result and error handling

Client calls are asynchronous. When a method accepts on_result:, handle both callback values: |result, error|. Availability and returned data can vary by platform.

Common service API

The service also supports the common Ruflet control API: attach_handler(event_name, handler), children, emit(event_name, event), has_handler?(event_name), id, merge_props(values = ...), on(event_name, &block), props, runtime_page, runtime_page=, to_patch, type, wire_id, wire_id=.

Use the named methods above for application code; common control methods mainly support event registration, updates, and runtime integration.

Wire reference

  • Service helper: url_launcher
  • Wire type: urllauncher
  • Aliases: urllauncher