Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is not for WebAssembly #139

Open
GoshenJimenez opened this issue Jun 14, 2024 · 0 comments
Open

This is not for WebAssembly #139

GoshenJimenez opened this issue Jun 14, 2024 · 0 comments

Comments

@GoshenJimenez
Copy link

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);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant