Skip to main content

Module space

Module space 

Source
Expand description

Space-level code generation.

Generates the top-level exported functions:

  • init() — initialise state to defaults (gas limit set to default constant)
  • dispatch_action(action_id: i32, payload_ptr: i32, payload_len: i32) — run an action
  • render(view_id: i32) -> i32 — render a view to Surface tree
  • get_state() -> i32 — return current state as a record value ptr
  • Conditionally: update(dt_ptr: i32), handle_event(event_ptr: i32)

Functions§

emit_dispatch_action
Emit the dispatch_action(action_id: i32, payload_ptr: i32, payload_len: i32) function.
emit_get_state
Emit the get_state() -> i32 function — returns the current state record.
emit_handle_event
Emit handle_event(event_ptr: i32) — param is a record value pointer.
emit_init
Emit the init() function (parameterless).
emit_render
Emit the render(view_id: i32) -> i32 function.
emit_update
Emit update(dt_ptr: i32) — param is a NUMBER value pointer.