StoragePaths service
Create or retrieve this service with page.storage_paths(**properties). Ruflet reuses the registered service unless you supply a different id.
Example
path = text(value: "Finding documents directory…")
page.add(path)
page.get_application_documents_directory(on_result: ->(directory, error) {
page.update(path, value: error ? error.to_s : directory.to_s)
})
Page accessor
page.storage_paths(**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.get_application_cache_directory(timeout: ..., on_result: ...)page.get_application_documents_directory(timeout: ..., on_result: ...)page.get_application_support_directory(timeout: ..., on_result: ...)page.get_downloads_directory(timeout: ..., on_result: ...)page.get_external_cache_directories(timeout: ..., on_result: ...)page.get_external_storage_directories(timeout: ..., on_result: ...)page.get_external_storage_directory(timeout: ..., on_result: ...)page.get_library_directory(timeout: ..., on_result: ...)page.get_temporary_directory(timeout: ..., on_result: ...)page.get_console_log_filename(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:
storage_paths - Wire type:
storagepaths - Aliases:
storagepaths