Class AnonymousRenderer
A renderer that invokes its callbacks.
This class is useful when you want an one-use ad-hoc implementation (i.e., Java-style anonymous class) of IRenderer interface.
Implements
Inherited Members
Namespace: Libplanet.Blockchain.Renderers
Assembly: Libplanet.dll
Syntax
public class AnonymousRenderer : IRenderer
Examples
With object initializers, you can easily make an one-use renderer:
var renderer = new AnonymousRenderer;
{
BlockRenderer = (oldTip, newTip) =>
{
// Implement RenderBlock() here.
};
};
Properties
| Improve this Doc View SourceBlockRenderer
A callback function to be invoked together with RenderBlock(Block, Block).
Declaration
public Action<Block, Block> BlockRenderer { get; set; }
Property Value
Type | Description |
---|---|
Action<Block, Block> |
Methods
| Improve this Doc View SourceRenderBlock(Block, Block)
Does things that should be done right after a new Block is appended to a BlockChain (so that its Tip has changed).
Declaration
public void RenderBlock(Block oldTip, Block newTip)
Parameters
Type | Name | Description |
---|---|---|
Block | oldTip | The previous Tip. |
Block | newTip | The current Tip. |
Remarks
It is guaranteed to be called only once for a block, and only after applied to the blockchain, unless it has been stale due to reorg.