ViewDeclaration
How a plugin computes a view: a function that produces the list, and the conditions under which the list must be computed again. A view is an ordered list of plain items, each identified by a key. The screen opens it by name, and then receives each change to it as it happens.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
A |
unknown |
the type of the arguments that the view accepts |
Properties
Section titled “Properties”byText?
Section titled “byText?”readonly byText?: boolean;When false, the rows that the list contains never depend on words, as is the case for a tag or for Today. An edited title or note then affects the list only where that row appears.
readonly time?: boolean;When true, the list depends on the time of day, so the app computes it again when the clock advances.
Methods
Section titled “Methods”compute()
Section titled “compute()”compute(args, context): PluginViewItem[];Produces the items of the list.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
args |
A |
the arguments with which the screen opened the view |
context |
ViewContext |
the state of the library and the means to search |
Returns
Section titled “Returns”the items, in order
touches()?
Section titled “touches()?”touches?(change): boolean;Says whether a change could alter the view. Without it, every change to a row, an outline or a search counts. A view that returns false for changes that cannot alter it is not worked out again for them.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
change |
Change |
the change to examine |
Returns
Section titled “Returns”boolean
true when the change could alter the view
