Contract
RegisterPage answers false when the page it was given cannot be drawn, which is also what
happens to a page whose fields are of the wrong type: what the map cannot render it refuses rather
than showing an empty screen. The reason is written to the console, so a refused page does not have
to be guessed at. RemovePage answers whether there was a page of that id to remove.
Registering an id twice replaces the first. OpenPage opens the map when it is closed, so a page can
be reached from a command or a key of your own resource.
Inputs
The page
The document
wide = true makes one take the full width.
A row of a list is
{ id, label, meta, icon, color, disabled, actions }. icon and color are a
marker sprite and colour, drawn the way the legend draws them. actions is a list of
{ id, label, variant } shown at the end of the row.
An item the map does not know is skipped, so a page written for a newer map still shows the rest of
its content.
Embedding your own interface
https, and its host must be the NUI origin of a resource on this server —
cfx-nui-<resource> and nothing more, so a registrable domain such as cfx-nui-x.example.com is not
one — or a host listed whole in hud.pageEmbedHosts. An address carrying a userinfo section
(https://cfx-nui-x@example.com/) loads example.com and is refused, as is one whose host is
percent-encoded or non-ASCII. Anything else is refused.
The frame is sandboxed and is not same-origin with the map, so the embedded page cannot reach the
map’s interface or its callbacks. It talks to its own resource, the way any NUI page does.
Outputs
The action table is
{ page, action, row, value }.
The map holds no state of its own for a page: answer an action by sending the page back with
SetPageContent.
A view has the last word on which pages it hosts: a page its
surface.pages does not list is neither drawn as a tab nor opened by OpenPage while that view is
on screen. The page stays registered and comes back with the next view that allows it.
Errors
RegisterPage answers false and says why in the console when a page has no id, no label, or
content that is neither a document nor an embeddable address. Nothing is registered: there is no
half-registered page and no tab.
An item the map does not understand is dropped from the page rather than refusing the whole of it,
so a page written for a newer map still shows the rest of its content. A section whose items is
missing is dropped the same way.
An embed whose address does not pass the rule above is refused at registration, so it never reaches
the interface. The interface applies the same rule again before it draws the frame, and shows
“Embedded page refused” in place of the page if it ever disagrees.
SetPageContent and RemovePage answer false for a page that is not registered.