realmPath
untyped stringrealmPath is this realm's own path, the one its gnomod.toml module line declares. It is written out rather than read from unsafe.CurrentRealm(), which reports the CALLER in every read this realm exports and would therefore build every link against whichever realm embedded the block.
Value
"gno.land/r/moul/reactions/v0"
board
*v0.Boardboard holds every page's tally. A redeploy would wipe it, which is why this realm is not private (see gnomod.toml): the state here belongs to everyone who reacted, and the only honest way to change this realm is a v1 beside it.
- OID
- 0b8280…0a70:4
board details
React
func(page string, key string)React records the caller's reaction to page. page is a package path, the full one: "gno.land/r/moul/home". It does not have to be a realm that embeds the block, and nothing checks that it exists. A page is just a name, which is what lets a realm key the block on something finer than itself. key is one of the palette names, not a glyph: "up", "heart", "fire", "party", "rocket", "eyes". Render("") lists them with their emoji. One reaction per address per page. Reacting again with a different key moves it; reacting with the same key changes nothing but the "last reaction" line.
- OID
- 0b8280…0a70:8
React details
Unreact
func(page string)Unreact removes the caller's reaction from page. It aborts when there is none, rather than succeeding silently, so a misspelled page key is visible instead of looking like a no-op.
- OID
- 0b8280…0a70:10
Unreact details
RenderBlock
func() stringRenderBlock returns the block for the realm CALLING it, which is the form a host realm embeds. It has no cur realm parameter on purpose. A plain read is borrowed: gno opens no realm frame for it, so unsafe.CurrentRealm() reports the caller's path and the block keys itself with no argument. Adding a cur realm here would silently reverse that and key every embed to this realm instead. Calling it from inside this realm therefore keys on this realm, which is never what a caller wants; the views below use the unexported blockFor.
- OID
- 0b8280…0a70:11
RenderBlock details
RenderBlockFor
func(page string) stringRenderBlockFor is [RenderBlock](#RenderBlock) for a named page. Use it from a crossing function, where there is no caller to read off the stack, or when one realm renders several pages.
- OID
- 0b8280…0a70:12
RenderBlockFor details
blockFor
func(page string) stringblockFor is the shared body, so no exported read of this realm calls another and picks up the wrong path.
- OID
- 0b8280…0a70:13
blockFor details
Count
func(page string) intCount reports how many addresses have a reaction on page.
- OID
- 0b8280…0a70:14
Count details
CountOf
func(page string, key string) intCountOf reports how many addresses hold one particular reaction on page.
- OID
- 0b8280…0a70:15
CountOf details
ReactionOf
func(page string, who .uverse.address) stringReactionOf returns who's current reaction key on page, or "" when they have none. A host realm can use it to say "you reacted" without reading the tree.
- OID
- 0b8280…0a70:16
ReactionOf details
Last
func(page string) (key string, who .uverse.address, height int64)- OID
- 0b8280…0a70:17
Last details
Pages
func() intPages reports how many pages have ever been reacted to.
- OID
- 0b8280…0a70:18
Pages details
maxListed
untyped bigintmaxListed caps the board index. The number of pages is unbounded (anyone can react to any key), and a Render that grows with it would eventually be too expensive to serve. The cap is on the INDEX only: every page keeps its own view at /r/moul/reactions/v0:\<page>, whether or not it is listed here.
Value
(25 <untyped> bigint)
Render
func(path string) stringRender serves two views: "" the getting-started page: how to embed the block, plus the board "<page>" one page's tally, where <page> is a package path The page view's path is the key itself, so the link under any embedded block is just this realm's path, a colon, and the page. That is why a page key may contain a colon of its own: "gno.land/r/you/blog:hello" reads back whole.
- OID
- 0b8280…0a70:19
Render details
selfURL
func() stringselfURL is this realm's own gnoweb path, derived from realmPath the same way every link in the block is, so there is one rule and not two. A function and not a package-level var: a package-level var in a realm is realm STATE, persisted and re-read on every call, which is a strange thing for a string the compiler could have folded.
- OID
- 0b8280…0a70:21
selfURL details
renderHome
func() string- OID
- 0b8280…0a70:22
renderHome details
renderBoard
func() stringrenderBoard lists pages in key order, not by activity. Key order is the order the tree already walks, so the listing is stable between identical calls; ranking would need a second index maintained on every write, which is a lot of machinery for a table nobody navigates by.
- OID
- 0b8280…0a70:23
renderBoard details
renderPage
func(page string) string- OID
- 0b8280…0a70:24