Skip to content

Commit

Permalink
update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinked committed Sep 26, 2019
1 parent 583d064 commit 8200152
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
8 changes: 4 additions & 4 deletions samples/Noty/Noty.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<RuntimeFrameworkName>Microsoft.AspNetCore.App</RuntimeFrameworkName>
</PropertyGroup>

<!--<ItemGroup>
<ItemGroup>
<PackageReference Include="NToastNotify" Version="6.0.1" />
</ItemGroup>-->
</ItemGroup>

<ItemGroup>
<!--<ItemGroup>
<ProjectReference Include="..\..\src\NToastNotify.csproj" />
</ItemGroup>
</ItemGroup>-->

</Project>
4 changes: 2 additions & 2 deletions samples/Toastr/Pages/Ajax.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public AjaxModel(IToastNotification toastNotification)
{
_toastNotification = toastNotification;
}
public JsonResult OnGet()
public JsonResult OnGet(string type)
{
System.Threading.Thread.Sleep(2000);
_toastNotification.AddSuccessToastMessage("This toast is shown on Ajax request. AJAX CALL " + DateTime.Now.ToLongTimeString());
_toastNotification.AddSuccessToastMessage($"This toast is shown on Ajax request. Type: {type} " + DateTime.Now.ToLongTimeString());
return new JsonResult(new { ok = true });
}

Expand Down
18 changes: 14 additions & 4 deletions samples/Toastr/Pages/Privacy.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@
window.addEventListener('load', function () {
setTimeout(function () {
$('#message').text('Making a native fetch request and show notification.');
fetch('/Ajax').then(function (response) {
fetch('/Ajax?type=fetch').then(function (response) {
var messages = nToastNotify.getMessagesFromFetchResponse(response);
nToastNotify.showMessages(messages);
$('#message').text('Making a XMLHTTPRequest (AJAX) and show notification.');
$('#message').text('Making an XMLHTTPRequest (AJAX) and show notification.');
$.ajax({
url: '/Ajax',
url: '/Ajax?type=xmlhttp',
}).then(function () {
$('#message').text('Again : Making an XMLHTTPRequest (AJAX) and show notification.');
$.ajax({
url: '/Ajax?type=xmlhttp'
}).then(function () {
$('#message').text('Again : native fetch request and show notification.');
fetch('/Ajax?type=fetch').then(function (response) {
var messages = nToastNotify.getMessagesFromFetchResponse(response);
nToastNotify.showMessages(messages);
});
})
});
});
}, 2000)
})
Expand Down
8 changes: 4 additions & 4 deletions samples/Toastr/Toastr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<RuntimeFrameworkName>Microsoft.AspNetCore.App</RuntimeFrameworkName>
</PropertyGroup>

<!--<ItemGroup>
<ItemGroup>
<PackageReference Include="NToastNotify" Version="6.0.1" />
</ItemGroup>-->
</ItemGroup>

<ItemGroup>
<!--<ItemGroup>
<ProjectReference Include="..\..\src\NToastNotify.csproj" />
</ItemGroup>
</ItemGroup>-->

</Project>

0 comments on commit 8200152

Please sign in to comment.