Class PageMessageCallbackRegistry
Namespace: ReadyM.Cef.Messaging
Assembly: ReadyM.Cef.dll
Which callback a message name belongs to, for every named message a page and the game exchange.
public sealed class PageMessageCallbackRegistry
Inheritance
object ← PageMessageCallbackRegistry
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
WRITTEN ON THE GAME THREAD WHILE MODS INITIALIZE, then frozen, then read from CEF's UI thread on every message. No lock, because PageMessageCallback) throws once frozen and no page exists before then.
Names are process-wide, not per browser, and typed messages share this table with raw ones.
Constructors
PageMessageCallbackRegistry()
public PageMessageCallbackRegistry()
Properties
Count
GAME THREAD. How many names are registered.
public int Count { get; }
Property Value
Methods
Add(string, PageMessageCallback)
GAME THREAD, while mods initialize. Claims name for callback.
public void Add(string name, PageMessageCallback callback)
Parameters
name string
callback PageMessageCallback
Remarks
THROWS ON A NAME ALREADY TAKEN, rather than replacing it. Replacing would leave the mod that claimed it first receiving nothing, with nothing anywhere saying why.
CefUiTryGet(ReadOnlySpan<char>, out PageMessageCallback)
CEF'S UI THREAD. What handles name, if anything does.
public bool CefUiTryGet(ReadOnlySpan<char> name, out PageMessageCallback callback)
Parameters
name ReadOnlySpan<char>
callback PageMessageCallback
Returns
Remarks
BY SPAN, so a delivery finds its callback without turning the name into a string first. Allocating one string per message would put every page's traffic on the garbage collector's path.