Header menu logo Sutil

Program Type

Main entry points for a Sutil program

Example

For example, this will mount the SutilElement returned from view() onto the div with id "sutil-app"

 view () |> Program.mount

Constructors

Constructor Description

Program()

Full Usage: Program()

Returns: Program
Returns: Program

Static members

Static member Description

Program.mount (doc, id, app)

Full Usage: Program.mount (doc, id, app)

Parameters:
Returns: IDisposable

Mount application on element with given id from specific document. Existing children at that node will be removed. Return value can be disposed to unmount and clean up.

doc : Document
id : string
app : SutilElement
Returns: IDisposable

Program.mount app

Full Usage: Program.mount app

Parameters:

Mount application on element with id "sutil-app". Existing children at that node will be removed. Return value is unit, so use alternate version mount( id, app ) if you need to unmount explicitly.

app : SutilElement

Program.mount (host, app)

Full Usage: Program.mount (host, app)

Parameters:
Returns: IDisposable

Mount application on given HTMLElement. Existing children at that node will be removed. Return value can be disposed to unmount and clean up.

host : HTMLElement
app : SutilElement
Returns: IDisposable

Program.mount (id, app)

Full Usage: Program.mount (id, app)

Parameters:
Returns: IDisposable

Mount application on element with given id. Existing children at that node will be removed. Return value can be disposed to unmount and clean up.

id : string
app : SutilElement
Returns: IDisposable

Program.mountAfter (prev, app)

Full Usage: Program.mountAfter (prev, app)

Parameters:
Returns: IDisposable

Mount application after given HTMLElement as a sibling. Return value can be disposed to unmount and clean up.

prev : HTMLElement
app : SutilElement
Returns: IDisposable

Program.mountAppend (prev, app)

Full Usage: Program.mountAppend (prev, app)

Parameters:
Returns: IDisposable

Mount application at given element, appending as last child and preserving existing children. Return value can be disposed to unmount and clean up.

prev : HTMLElement
app : SutilElement
Returns: IDisposable

Program.unmount node

Full Usage: Program.unmount node

Parameters:

Remove this node, cleaning up all related Sutil resources. By design, it should be rare that you need to use this, but it provides a Sutil-safe way to remove nodes from the DOM. One use case is a Modal component that could be appended to the body element, and then unmounted upon close. Even in that case, you might find it's neater to use a Bind.el() or Bind.visible() (or a combination) to control the content and visibility of the modal.

node : Node

Type something to start searching.