Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinki14 committed Dec 28, 2023
1 parent 99f7e04 commit fae1762
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ An unofficial set of extensions for developing Nui interfaces with Blazor WASM i
- For Nui Message handling, the [NuiMessageListener](src/CitizenFX.Extensions.Blazor.WebAssembly/NuiMessageListener.cs) must be injected as a root-component in index.html, and your component(s) must inherit [NuiComponent](src/CitizenFX.Extensions.Blazor.WebAssembly/NuiComponent.cs)
- Add `<template id="nui-message-listener"></template>` to your `index.html` in the `<body>`
- Add `builder.RootComponents.Add<NuiMessageListener>("#nui-message-listener");` in your `Program.cs`
- This adds some Javascript to your `<body>` that directs any Nui Messages for the resource to `NuiMessageListener`
- This adds some Javascript to your `<body>` that directs any Nui Messages for the resource to `NuiMessageListener`
- Add `@inherits NuiComponent` in your component/razor page
- This is required for `NuiMessageListener` to `NuiMessageHandler`'s
- Add `[NuiMessageHandler("<identifier>")]` to any static or instanced method in your component


- For triggering Nui Callbacks, [NuiCallbackService](src/CitizenFX.Extensions.Blazor.WebAssembly/Services/NuiCallbackService.cs) must be added to your service collection
- Add `builder.Services.AddNuiServices();` in your `Program.cs`
- Inject in your page with `@inject INuiCallbackService NuiCallbackService`
Expand Down

0 comments on commit fae1762

Please sign in to comment.