raas-server
Version:
rhamt as a service server
36 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const raas_core_1 = require("raas-core");
class NotificationService {
constructor(clientSerivce) {
this.clientService = clientSerivce;
}
onErrorStartingServer(data) {
this.notify(raas_core_1.Messages.Client.ErrorStartingServerNotification.type, data);
}
onServerStarted(handle) {
this.notify(raas_core_1.Messages.Client.ServerStartedNotification.type, handle);
}
onServerMessage(config, msg) {
this.notify(raas_core_1.Messages.Client.ServerMessageNotification.type, { config, msg });
}
onServerStopped(handle) {
this.notify(raas_core_1.Messages.Client.ServerStoppedNotification.type, handle);
}
onMessage(data) {
this.notify(raas_core_1.Messages.Client.AnalysisMessageNotification.type, { config: data.analysis, msg: data.msg });
}
onAnalysisStarted(analysis) {
this.notify(raas_core_1.Messages.Client.AnalysisStartedNotification.type, analysis);
}
onAnalysisCancelled(analysis) {
this.notify(raas_core_1.Messages.Client.AnalysisCancelledNotification.type, analysis);
}
notify(type, data) {
this.clientService.clients.forEach(client => {
client.connection.sendNotification(type, data);
});
}
}
exports.NotificationService = NotificationService;
//# sourceMappingURL=notificationService.js.map