mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-07-29 07:01:35 +00:00
Stop polling. Use SocketIO!
This commit is contained in:
@@ -11,33 +11,31 @@
|
||||
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='fonts/material-icons/material-icons.css') }}">
|
||||
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/materialize.min.css') }}" media="screen,projection"/>
|
||||
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/opaque.css') }}" media="screen,projection"/>
|
||||
{% if current_user.is_authenticated %}
|
||||
<script>
|
||||
var corpora = [
|
||||
{% for corpus in current_user.corpora.all() %}
|
||||
{{ corpus.to_dict()|tojson }},
|
||||
{% endfor %}
|
||||
];
|
||||
var jobs = [
|
||||
{% for job in current_user.jobs.all() %}
|
||||
{{ job.to_dict()|tojson }},
|
||||
{% endfor %}
|
||||
];
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/jsondiffpatch.umd.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/polls.js') }}"></script>
|
||||
{% endif %}
|
||||
<script src="{{ url_for('static', filename='js/socket.io.js') }}"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var socket = io();
|
||||
socket.on('connect', function() {
|
||||
socket.emit('my event', {data: 'I\'m connected!'});
|
||||
});
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/list.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/list.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/list.utils.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/CorpusList.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/JobList.js') }}"></script>
|
||||
<script>
|
||||
var corpora;
|
||||
var corporaSubscribers = [];
|
||||
var jobs;
|
||||
var jobsSubscribers = [];
|
||||
</script>
|
||||
<script>
|
||||
var socket = io();
|
||||
|
||||
socket.on('corpora', function(msg) {
|
||||
corpora = JSON.parse(msg.data);
|
||||
for (subscriber of corporaSubscribers) {subscriber.init();}
|
||||
});
|
||||
|
||||
|
||||
socket.on('jobs', function(msg) {
|
||||
jobs = JSON.parse(msg.data);
|
||||
for (subscriber of jobsSubscribers) {subscriber.init();}
|
||||
});
|
||||
</script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<body>
|
||||
|
Reference in New Issue
Block a user