Macaw.RequestReads behaviour (macaw v0.6.0)

Copy Markdown View Source

The parameters a slot's request reads (spec/03 §1.5, #441): a component's optional answer, a behavior of macaw's as Macaw.Container is.

A slot's request reads its cell's settings only through the component's order/2 and budget/3. A component that names the parameters they read, request_reads(slot), says that a change of any other setting changes its markup and never its request, so Macaw.State.affected/2 renders the cell and fetches nothing for it. A component that doesn't answer reads every setting, as any component's request may.

Summary

Callbacks

The parameters slot's request reads: those its order/2 and budget/3 read.

Functions

Whether module's slot request reads the parameter param: as its request_reads/1 answers, else true.

Callbacks

request_reads(slot)

@callback request_reads(slot :: String.t()) :: [String.t()]

The parameters slot's request reads: those its order/2 and budget/3 read.

Functions

reads?(module, slot, param)

@spec reads?(module(), String.t(), String.t()) :: boolean()

Whether module's slot request reads the parameter param: as its request_reads/1 answers, else true.

iex> Macaw.RequestReads.reads?(Macaw.Builtin.Table, "rows", "sort")
true
iex> Macaw.RequestReads.reads?(Macaw.Builtin.Table, "rows", "caption")
false
iex> Macaw.RequestReads.reads?(Macaw.Builtin.Feed, "rows", "label")
true