/// <summary> /// Function to display a simple SweetAlert2 modal. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="type"></param> /// <returns></returns> public async Task <SweetAlertResult> FireAsync(string title, string message = null, SweetAlertType type = null) { var tcs = new TaskCompletionSource <SweetAlertResult>(); Guid requestId = Guid.NewGuid(); PendingFireRequests.Add(requestId, tcs); await jSRuntime.InvokeAsync <object>("CurrieTechnologies.Blazor.SweetAlert2.Fire", requestId, title, message, type?.ToString()); return(await tcs.Task); }
/// <summary> /// Function to display a simple SweetAlert2 modal. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="type"></param> /// <returns></returns> public Task <SweetAlertResult> FireAsync(string title, string message = null, SweetAlertType type = null) { SweetAlertOptions newSettings = this.Mix(this.storedOptions); newSettings.Title = title; newSettings.Html = message ?? newSettings.Html; newSettings.Type = type ?? newSettings.Type; return(this.swal.FireAsync(newSettings)); }