Message cleanup

This commit is contained in:
Frank A. Krueger 2017-06-14 23:30:48 -07:00
parent 0683cf91ed
commit dfa658d075
2 changed files with 6 additions and 9 deletions

View File

@ -22,7 +22,7 @@ namespace Ooui
protected EventTarget (string tagName) protected EventTarget (string tagName)
{ {
TagName = tagName; TagName = tagName;
Send (new Message { Send (new Message {
MessageType = MessageType.Create, MessageType = MessageType.Create,
TargetId = Id, TargetId = Id,
@ -46,7 +46,11 @@ namespace Ooui
handlers.Add (handler); handlers.Add (handler);
if (sendListen) if (sendListen)
Send (Message.Listen (Id, eventType)); Send (new Message {
MessageType = MessageType.Listen,
TargetId = Id,
Key = eventType,
});
} }
public void RemoveEventListener (string eventType, EventHandler handler) public void RemoveEventListener (string eventType, EventHandler handler)

View File

@ -26,12 +26,6 @@ namespace Ooui
set => v = FixupValue (value); set => v = FixupValue (value);
} }
public static Message Listen (string targetId, string eventType) => new Message {
MessageType = MessageType.Listen,
TargetId = targetId,
Key = eventType,
};
public static Message Event (string targetId, string eventType) => new Message { public static Message Event (string targetId, string eventType) => new Message {
MessageType = MessageType.Event, MessageType = MessageType.Event,
TargetId = targetId, TargetId = targetId,
@ -53,7 +47,6 @@ namespace Ooui
return v; return v;
} }
static long idCounter = 0; static long idCounter = 0;
static long GenerateId () static long GenerateId ()
{ {