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> <script>
var corpusList = new RessourceList("corpora", nopaque.foreignCorporaSubscribers, "corpus"); var corpusList = new RessourceList("corpora", nopaque.foreignCorporaSubscribers, "corpus");
var jobList = new RessourceList("jobs", nopaque.foreignJobsSubscribers, var jobList = new RessourceList("jobs", nopaque.foreignJobsSubscribers, "job");
"job"); document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("foreign_user_ressources_init", {{ user.id }}); nopaque.socket.emit("foreign_user_ressources_init", {{ user.id }});
});
</script> </script>
{% endblock %} {% endblock %}

View File

@ -186,7 +186,9 @@
var informationUpdater = new InformationUpdater({{ corpus.id }}, false); var informationUpdater = new InformationUpdater({{ corpus.id }}, false);
{% else %} {% else %}
var informationUpdater = new InformationUpdater({{ corpus.id }}, true); 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 %} {% endif %}
</script> </script>
{% endblock %} {% endblock %}

View File

@ -259,7 +259,9 @@
var informationUpdater = new InformationUpdater({{ job.id }}, false); var informationUpdater = new InformationUpdater({{ job.id }}, false);
{% else %} {% else %}
var informationUpdater = new InformationUpdater({{ job.id }}, true); 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 %} {% endif %}
</script> </script>
{% endblock %} {% endblock %}