Reorganize Socket.IO code

This commit is contained in:
Patrick Jentsch
2024-11-18 12:36:37 +01:00
parent 9f56647cf7
commit 1e5c26b8e3
13 changed files with 95 additions and 100 deletions

View File

@ -15,7 +15,7 @@ nopaque.resource_lists.CorpusFileList = class CorpusFileList extends nopaque.res
this.hasPermissionManageFiles = listContainerElement.dataset?.hasPermissionManageFiles == 'true' || false;
if (this.userId === undefined || this.corpusId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -13,7 +13,7 @@ nopaque.resource_lists.CorpusFollowerList = class CorpusFollowerList extends nop
this.corpusId = listContainerElement.dataset.corpusId;
if (this.userId === undefined || this.corpusId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -12,7 +12,7 @@ nopaque.resource_lists.CorpusList = class CorpusList extends nopaque.resource_li
this.userId = listContainerElement.dataset.userId;
if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -13,7 +13,7 @@ nopaque.resource_lists.JobList = class JobList extends nopaque.resource_lists.Re
this.userId = listContainerElement.dataset.userId;
if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -9,7 +9,7 @@ nopaque.resource_lists.JobResultList = class JobResultList extends nopaque.resou
this.jobId = listContainerElement.dataset.jobId;
if (this.userId === undefined || this.jobId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -9,7 +9,7 @@ nopaque.resource_lists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelLi
this.userId = listContainerElement.dataset.userId;
if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});

View File

@ -9,7 +9,7 @@ nopaque.resource_lists.TesseractOCRPipelineModelList = class TesseractOCRPipelin
this.userId = listContainerElement.dataset.userId;
if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.sockets.users.on('patch_user', (patch) => {
app.socket.on('patch_user', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
});
});