Splitted the node server in modules

This commit is contained in:
Gaël Métais
2014-08-07 19:26:58 +02:00
parent 9b6b0f39f0
commit 7fcdf2aaa2
17 changed files with 407 additions and 250 deletions
+45
View File
@@ -0,0 +1,45 @@
<html>
<head>
<meta charset="utf-8">
<title>Javascript Spaghetti Profiler</title>
<link rel="stylesheet" type="text/css" href="/public/styles/main.css">
<link rel="stylesheet" type="text/css" href="/public/styles/launchTest.css">
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<h1>Javascript Spaghetti Profiler</h1>
<div id="status"></div>
<div>%%TEST_URL%%</div>
<script>
var testId = '%%TEST_ID%%';
var statusElement = document.getElementById('status');
var socket = io();
function askStatus() {
socket.emit('waiting', testId);
}
socket.on('position', function(position) {
if (position === 0) {
statusElement.innerHTML = 'Running';
} else {
statusElement.innerHTML = 'Waiting behind ' + (position) + ' other tests';
}
});
socket.on('complete', function() {
statusElement.innerHTML = 'Test complete';
window.location.replace('/results/' + testId);
});
socket.on('404', function() {
statusElement.innerHTML = 'Test not found';
});
askStatus();
</script>
</body>
</html>