Add .NET Core 2.1 versions
This commit is contained in:
31
result/dotnet/Result/wwwroot/js/results.js
Normal file
31
result/dotnet/Result/wwwroot/js/results.js
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
var connection = new signalR.HubConnectionBuilder().withUrl("/resultsHub").build();
|
||||
|
||||
connection.on("UpdateResults", function (results) {
|
||||
data = JSON.parse(json);
|
||||
|
||||
var a = parseInt(data.optionA || 0);
|
||||
var b = parseInt(data.optionB || 0);
|
||||
var percentages = getPercentages(a, b);
|
||||
|
||||
document.getElementById("optionA").innerText = percentages.a + "%";
|
||||
document.getElementById("optionB").innerText = percentages.b + "%";
|
||||
});
|
||||
|
||||
connection.start().catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
|
||||
function getPercentages(a, b) {
|
||||
var result = {};
|
||||
|
||||
if (a + b > 0) {
|
||||
result.a = Math.round(a / (a + b) * 100);
|
||||
result.b = 100 - result.a;
|
||||
} else {
|
||||
result.a = result.b = 50;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
4
result/dotnet/Result/wwwroot/js/site.js
Normal file
4
result/dotnet/Result/wwwroot/js/site.js
Normal file
@ -0,0 +1,4 @@
|
||||
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your Javascript code.
|
0
result/dotnet/Result/wwwroot/js/site.min.js
vendored
Normal file
0
result/dotnet/Result/wwwroot/js/site.min.js
vendored
Normal file
Reference in New Issue
Block a user