deleted extraneous event classes
parent
3f31e27d18
commit
c0373703f8
@ -1,28 +0,0 @@
|
||||
export const MEMBER_STATUS = "memberStatus";
|
||||
export const LOGIN_STATUS = 'loginStatus';
|
||||
export const SUPPORTER_FOUND = 'SUPPORTER FOUND';
|
||||
export const SUPPORTER_LISTED = 'SUPPORTER LISTED';
|
||||
export const SUPPORTER_NOT_FOUND = 'SUPPORTER NOT FOUND';
|
||||
export const MEMBER_ADDED = 'MEMBER ADDED';
|
||||
export const MEMBER_NOT_ADDED = 'MEMBER NOT ADDED';
|
||||
export const MEMBER_LOGIN_GOOD = 'MEMBER LOGIN GOOD';
|
||||
export const MEMBER_LOGIN_LAME = 'MEMBER LOGIN LAME';
|
||||
export const MEMBER_EXISTS = 'USER ALREADY EXISTS';
|
||||
export const MEMBER_LOGIN_MISSING = 'Missing credentials';
|
||||
|
||||
|
||||
|
||||
class AuthEvent
|
||||
{
|
||||
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
|
||||
|
||||
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
export default new AuthEvent
|
@ -1,14 +0,0 @@
|
||||
export const EDITOR_DELETE = 'editorDelete';
|
||||
export const EDITOR_UPLOAD_POST_IMAGE = 'editorUploadImage';
|
||||
export const EDITOR_SAVE = 'editorSave';
|
||||
export const EDITOR_UPDATE = 'editorUpdate';
|
||||
|
||||
class EditorEvent {
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
export default new EditorEvent();
|
@ -1,52 +0,0 @@
|
||||
class EventEmitter {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {
|
||||
this.listeners = new Map();
|
||||
}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
addListener(label, callback) {
|
||||
this.listeners.has(label) || this.listeners.set(label, []);
|
||||
this.listeners.get(label).push(callback);
|
||||
}
|
||||
|
||||
removeListener(label, callback) {
|
||||
var isFunction = function(obj) {
|
||||
return typeof obj == 'function' || false;
|
||||
};
|
||||
|
||||
var listeners = this.listeners.get(label),
|
||||
index;
|
||||
|
||||
if (listeners && listeners.length) {
|
||||
index = listeners.reduce((i, listener, index) => {
|
||||
return isFunction(listener) && listener === callback ? (i = index) : i;
|
||||
}, -1);
|
||||
|
||||
if (index > -1) {
|
||||
listeners.splice(index, 1);
|
||||
this.listeners.set(label, listeners);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
emitEvent(label, ...args) {
|
||||
var listeners = this.listeners.get(label);
|
||||
if (listeners && listeners.length) {
|
||||
listeners.forEach(listener => {
|
||||
listener(...args);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
export default EventEmitter;
|
Loading…
Reference in New Issue