-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Update doc with another sample for Es5 JS (#5994)
Update doc with another sample for Es5 JS
- Loading branch information
1 parent
b3105af
commit 253210f
Showing
19 changed files
with
163 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
@page | ||
@model AboutModel | ||
@{ | ||
ViewData["Title"] = "About"; | ||
ViewData["Title"] = "About SignalRChat"; | ||
} | ||
<h2>@ViewData["Title"]</h2> | ||
<h3>@Model.Message</h3> | ||
|
||
<p>Use this area to provide additional information.</p> | ||
<p>This is a simple ASP.NET Core SignalR Chat example</p> | ||
<p> | ||
This example demonstrates: | ||
<ul> | ||
<li>SignalR Startup</li> | ||
<li>Hubs</li> | ||
<li>JavaScript Client</li> | ||
</ul> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,4 @@ | |
Redmond, WA 98052-6399<br /> | ||
<abbr title="Phone">P:</abbr> | ||
425.555.0100 | ||
</address> | ||
|
||
<address> | ||
<strong>Support:</strong> <a href="mailto:[email protected]">Support@example.com</a><br /> | ||
<strong>Marketing:</strong> <a href="mailto:[email protected]">Marketing@example.com</a> | ||
</address> | ||
</address> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
@page | ||
<div class="row"> </div> | ||
<div class="row"> | ||
<div class="col-12"> | ||
User..........<input type="text" id="userInput" /> | ||
<br /> | ||
Message...<input type="text" id="messageInput" /> | ||
<input type="button" id="sendButton" value="Send Message" /> | ||
<div class="container"> | ||
<div class="row"> </div> | ||
<div class="row"> | ||
<div class="col-6"> </div> | ||
<div class="col-6"> | ||
User..........<input type="text" id="userInput" /> | ||
<br /> | ||
Message...<input type="text" id="messageInput" /> | ||
<input type="button" id="sendButton" value="Send Message" /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<hr /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-6"> </div> | ||
<div class="col-6"> | ||
<ul id="messagesList"></ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<hr /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<ul id="messagesList"></ul> | ||
</div> | ||
</div> | ||
<script src="~/lib/signalr/signalr.js"></script> | ||
<script src="~/js/chat.js"></script> | ||
<script src="~/lib/signalr/signalr.js"></script> | ||
<script src="~/js/chat.js"></script> | ||
@*<script src="~/js/es5-chat.js"></script>*@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
aspnetcore/signalr/get-started/sample/appsettings.Development.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
aspnetcore/signalr/get-started/sample/wwwroot/js/es5-chat.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// To use the following code sample: | ||
// In Pages\Index.cshtml, | ||
// comment line #26: "<script src="~/js/chat.js"></script>" | ||
// uncomment line #27: "<script src="~/js/es5-chat.js"></script>" | ||
|
||
"use strict"; | ||
|
||
var connection = new signalR.HubConnection("/chathub", { logger: signalR.LogLevel.Information }); | ||
|
||
connection.on("ReceiveMessage", function (user, message) { | ||
var encodedMsg = user + " says " + message; | ||
var li = document.createElement("li"); | ||
li.textContent = encodedMsg; | ||
document.getElementById("messagesList").appendChild(li); | ||
}); | ||
|
||
document.getElementById("sendButton").addEventListener("click", function (event) { | ||
var user = document.getElementById("userInput").value; | ||
var message = document.getElementById("messageInput").value; | ||
connection.invoke("SendMessage", user, message).catch(function (err) { | ||
return console.error; | ||
}); | ||
event.preventDefault(); | ||
}); | ||
|
||
connection.start().catch(function (err) { | ||
return console.error; | ||
}); |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// The following sample code uses modern ECMAScript 6 features | ||
// that aren't supported in Internet Explorer 11. | ||
// To convert the sample for environments that do not support ECMAScript 6, | ||
// such as Internet Explorer 11, use a transpiler such as | ||
// Babel at http://babeljs.io/. | ||
// | ||
// See Es5-chat.js for a Babel transpiled version of the following code: | ||
var connection = new signalR.HubConnection("/chathub", { logger: signalR.LogLevel.Information }); | ||
connection.on("ReceiveMessage", function (user, message) { | ||
var encodedMsg = user + " says " + message; | ||
var li = document.createElement("li"); | ||
li.textContent = encodedMsg; | ||
document.getElementById("messagesList").appendChild(li); | ||
}); | ||
document.getElementById("sendButton").addEventListener("click", function (event) { | ||
var user = document.getElementById("userInput").value; | ||
var message = document.getElementById("messageInput").value; | ||
connection.invoke("SendMessage", user, message).catch(function (err) { return console.error; }); | ||
event.preventDefault(); | ||
}); | ||
connection.start().catch(function (err) { return console.error; }); |
Oops, something went wrong.