Skip to main content

CLICK

Constant CLICK 

Source
pub const CLICK: &str = "trait Click { func click() -> Unit; }";
Expand description

A typed interaction contract with one click operation.

Implement Click when a type should satisfy a nominal interaction contract or appear in query[Click](). Hosts may also invoke an ordinary checked click method without this trait; the host owns event dispatch.

§Declaration

trait Click { func click() -> Unit; }

§Fields and methods

  • click: Required action with no arguments. A direct record method may mutate its receiver; a bound component callback is required when that mutation must persist to an entity.

§Implement a click action

A type satisfies the contract with a matching typed method.

type Example {}

impl Click for Example {
  func click() -> Unit { print("clicked"); }
}

let value = Example {};
value.click();