Skip to content

Commit

Permalink
Added ability to chain toast parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissainty committed Feb 16, 2023
1 parent 8d8508a commit 1c7a8a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions samples/BlazorWebAssembly/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
protected override void OnInitialized()
{
_toastParameters = new ToastParameters();
_toastParameters.Add(nameof(MyToastComponent.Title), "I'm a custom toast component with parameters");
_toastParameters.Add(nameof(MyToastComponent.ToastParam), "I'm a parameter");
_toastParameters = new ToastParameters()
.Add(nameof(MyToastComponent.Title), "I'm a custom toast component with parameters")
.Add(nameof(MyToastComponent.ToastParam), "I'm a parameter");
}
private void OnShowHtml()
Expand Down
3 changes: 2 additions & 1 deletion src/Blazored.Toast/ToastParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ public ToastParameters()
{
Parameters = new Dictionary<string, object>();
}
public void Add(string parameterName, object value)
public ToastParameters Add(string parameterName, object value)
{
Parameters[parameterName] = value;
return this;
}

public T Get<T>(string parameterName)
Expand Down

0 comments on commit 1c7a8a8

Please sign in to comment.