1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-10-13 22:41:57 +00:00

Add chat:pre-send-message event for outgoing message processing. (Does not currently allow you to modify the message. Fixan issue with the emote menu. Add setting to always show deleted messages.

This commit is contained in:
SirStendec 2018-05-22 17:23:20 -04:00
parent c7e8d39bc2
commit 3df7f0472d
8 changed files with 84 additions and 5 deletions

View file

@ -5,7 +5,8 @@
import {has} from 'utilities/object';
const Detach = {};
const Detach = Symbol('Detach');
const StopPropagation = Symbol('StopPropagation');
const SNAKE_CAPS = /([a-z])([A-Z])/g,
SNAKE_SPACE = /[ \t\W]/g,
@ -140,6 +141,9 @@ export class EventEmitter {
else
item[2] = ttl - 1;
}
if ( (args[0] instanceof FFZEvent && args[0].propagationStopped) || ret === StopPropagation )
break;
}
if ( removed.size ) {
@ -187,6 +191,9 @@ export class EventEmitter {
else
item[2] = ttl - 1;
}
if ( (args[0] instanceof FFZEvent && args[0].propagationStopped) || ret === StopPropagation )
break;
}
if ( removed.size ) {
@ -275,6 +282,26 @@ export class EventEmitter {
}
EventEmitter.Detach = Detach;
EventEmitter.StopPropagation = StopPropagation;
export class FFZEvent {
constructor(data) {
this.defaultPrevented = false;
this.propagationStopped = false;
Object.assign(this, data);
}
stopPropagation() {
this.propagationStopped = true;
}
preventDefault() {
this.defaultPrevented = true;
}
}
export class HierarchicalEventEmitter extends EventEmitter {