Add convenience Call ctor for Message
This commit is contained in:
parent
a8b227ec1c
commit
8e1da8c190
|
@ -108,12 +108,7 @@ namespace Ooui
|
|||
|
||||
protected void SendCall (string methodName, params object[] args)
|
||||
{
|
||||
Send (new Message {
|
||||
MessageType = MessageType.Call,
|
||||
TargetId = Id,
|
||||
Key = methodName,
|
||||
Value = args,
|
||||
});
|
||||
Send (Message.Call (Id, methodName, args));
|
||||
}
|
||||
|
||||
protected void SendSet (string attributeName, object value)
|
||||
|
|
|
@ -22,6 +22,13 @@ namespace Ooui
|
|||
[JsonProperty("v")]
|
||||
public object Value = null;
|
||||
|
||||
public static Message Call (string targetId, string method, params object[] args) => new Message {
|
||||
MessageType = MessageType.Call,
|
||||
TargetId = targetId,
|
||||
Key = method,
|
||||
Value = args,
|
||||
};
|
||||
|
||||
public static Message Event (string targetId, string eventType) => new Message {
|
||||
MessageType = MessageType.Event,
|
||||
TargetId = targetId,
|
||||
|
|
|
@ -353,12 +353,8 @@ namespace Ooui
|
|||
//
|
||||
// Add it to the document body
|
||||
//
|
||||
await SendMessageAsync (webSocket, new Message {
|
||||
TargetId = "document.body",
|
||||
MessageType = MessageType.Call,
|
||||
Key = "appendChild",
|
||||
Value = new[] { element },
|
||||
}, element, createdIds, token).ConfigureAwait (false);
|
||||
await SendMessageAsync (webSocket, Message.Call ("document.body", "appendChild", element),
|
||||
element, createdIds, token).ConfigureAwait (false);
|
||||
|
||||
//
|
||||
// Listen for events
|
||||
|
|
Loading…
Reference in New Issue