Wrap socket usage in DOMContentLoaded eventlistener

This commit is contained in:
Patrick Jentsch 2020-03-28 11:57:12 +01:00
parent a51394dddd
commit 970d7024e0
3 changed files with 10 additions and 5 deletions

View File

@ -101,8 +101,9 @@
<script>
var corpusList = new RessourceList("corpora", nopaque.foreignCorporaSubscribers, "corpus");
var jobList = new RessourceList("jobs", nopaque.foreignJobsSubscribers,
"job");
nopaque.socket.emit("foreign_user_ressources_init", {{ user.id }});
var jobList = new RessourceList("jobs", nopaque.foreignJobsSubscribers, "job");
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("foreign_user_ressources_init", {{ user.id }});
});
</script>
{% endblock %}

View File

@ -186,7 +186,9 @@
var informationUpdater = new InformationUpdater({{ corpus.id }}, false);
{% else %}
var informationUpdater = new InformationUpdater({{ corpus.id }}, true);
nopaque.socket.emit('subscribe_foreign_user_ressources', {{ corpus.user_id }});
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("subscribe_foreign_user_ressources", {{ corpus.user_id }});
});
{% endif %}
</script>
{% endblock %}

View File

@ -259,7 +259,9 @@
var informationUpdater = new InformationUpdater({{ job.id }}, false);
{% else %}
var informationUpdater = new InformationUpdater({{ job.id }}, true);
nopaque.socket.emit('foreign_user_ressources_init', {{ job.user_id }});
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("foreign_user_ressources_init", {{ job.user_id }});
});
{% endif %}
</script>
{% endblock %}