timer/public/js/main.js

23 lines
528 B
JavaScript
Raw Permalink Normal View History

2024-10-27 14:47:03 +02:00
// a bit hackish way to find the path but it will get the job done
var socket = io({"path": window.location.pathname.replace(/(\/control\/?|\/)?$/, "") + "/socket.io"});
2012-06-05 08:45:50 +03:00
socket.on('time', function (data) {
$('#countdown').html(data.time);
});
$('#start').click(function() {
socket.emit('click:start');
});
$('#stop').click(function() {
socket.emit('click:stop');
2012-06-05 08:45:50 +03:00
});
$('#reset').click(function() {
socket.emit('click:reset');
});
$('#resetShort').click(function() {
socket.emit('click:resetShort');
});