1
0
Fork 0

events module

This commit is contained in:
Ruben Meyer 2019-06-17 02:44:02 +02:00
parent f0863b517a
commit 6e9e666e19
1 changed files with 28 additions and 0 deletions

28
bin/events/module.js Normal file
View File

@ -0,0 +1,28 @@
/*
* This file is part of the authRXBN single sign-on package.
*
* (c) Ruben Meyer <contact@rxbn.de>
*/
// init
// GCS: Global Communication System
let EventEmitter = require('events');
global['gcs'] = new EventEmitter.EventEmitter();
/**
* Error Message Handler
* @author Ruben Meyer
* @param {String} message data: "MODULE SEPARATOR MESSAGE"
* @return {void}
*/
global['gcs'].on('err', (data) => {
separator = "->";
i = data.indexOf(separator);
parts = [data.slice(0, i), data.slice(i+separator.length)];
for (let a in parts) {
if(parts.hasOwnProperty(a))
parts[a] = parts[a].trim();
}
console.log("ERROR: Module: \""+parts[0]+"\"; Message: "+parts[1]);
});