Skip to content

This is not for WebAssembly #139

@GoshenJimenez

Description

@GoshenJimenez

I realize that this component is not working in WASM or at least I have not been able to make it work (out of the box) from a WASM Project. The OnAfterRenderAsync method is not called from WASM. It works on Blazor Server but not for WASM as far as I know. Please feel free to correct me and or show me how to get it working on WASM if I am wrong.

@using Blazor.Extensions.Canvas.Canvas2D;
@using Blazor.Extensions.Canvas
@using Blazor.Extensions;


<BECanvas Width="300" Height="400" @ref="_bgCanvas" ></BECanvas>

@code {
    private Canvas2DContext? _bgContext;
    protected BECanvasComponent? _bgCanvas;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        this._bgContext = await this._bgCanvas.CreateCanvas2DAsync();
        await this._bgContext.SetFillStyleAsync("green");

        await this._bgContext.FillRectAsync(10, 100, 100, 100);

        await this._bgContext.SetFontAsync("48px serif");
        await this._bgContext.StrokeTextAsync("Hello Blazor!!!", 10, 100);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions