TreehouseApp

@ObjCName(name = "TreehouseApp", exact = true)
abstract class TreehouseApp<A : AppService> : AutoCloseable

Manages the Zipline runtimes that run the code to power on-screen views.

This takes care to launch a Zipline when it is requested and available.

  • Requested: The runtime is started either explicitly via a call to start, or implicitly by calling binding creating content to a UI.

  • Available: The runtime is available when its code is ready, either via a download, embedded in the host application, or through the cache from an earlier execution.

If new code is available during execution (typically during development), this will perform a hot reload: gracefully stopping the current Zipline and starting its successor. It also implements restarting the Zipline after an uncaught exception (in both development and production).

It is rarely necessary to call the start, stop, and restart methods directly. Calling createContent will trigger a start automatically. Use close to permanently stop the Zipline.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
@ObjCName(name = "TreehouseAppFactory", exact = true)
interface Factory : AutoCloseable

Creates new instances of TreehouseApp.

Link copied to clipboard
abstract class Spec<A : AppService>

Configuration and code to launch a Treehouse application.

Properties

Link copied to clipboard
Link copied to clipboard
abstract val name: String
Link copied to clipboard
abstract val zipline: StateFlow<Zipline?>

Returns the current zipline attached to this host, or null if Zipline hasn't loaded yet. The returned value will be invalid when new code is loaded.

Functions

Link copied to clipboard
abstract override fun close()

Permanently stop the app and release any resources necessary to start it again.

Link copied to clipboard
abstract fun createContent(source: TreehouseContentSource<A>, codeListener: CodeListener = CodeListener()): Content

Create content for source.

Link copied to clipboard
abstract fun restart()

Stop the currently-running application (if any) and start it again.

Link copied to clipboard
abstract fun start()

Initiate the initial code download and load, and start driving the views that are rendered by this app.

Link copied to clipboard
abstract fun stop()

Stop any currently-running code and stop receiving new code.