Skip to main content

WebWorkerPostMessageEventArgs

Namespace: Wisej.Ext.WebWorker

Assembly: Wisej.Ext.WebWorker (4.1.0.0)

Provides data for the PostMessage event.

public class WebWorkerPostMessageEventArgs : EventArgs

Example:

The following example reads a complex object posted by the worker with postMessage({ progress: 50, done: false }):

private void webWorker_PostMessage(object sender, WebWorkerPostMessageEventArgs e)
{
dynamic message = e.Data;

this.progressBar.Value = (int)message.progress;
if ((bool)message.done)
AlertBox.Show("Completed!");
}

Constructors​

Instance member WebWorkerPostMessageEventArgs(e)​

Initializes a new instance of WebWorkerPostMessageEventArgs from the specified event data.

NameTypeDescription
eWisejEventArgsAn instance of WisejEventArgs with the event data sent by the client.

This constructor is used by the WebWorker component when it processes the postMessage event from the client. It's typically used in a derived class that processes additional client events.

Example:

public class MyWebWorker : WebWorker
{
protected override void OnWebEvent(WisejEventArgs e)
{
if (e.Type == "postMessage")
{
var args = new WebWorkerPostMessageEventArgs(e);
System.Diagnostics.Debug.WriteLine(args.Data);
}

base.OnWebEvent(e);
}
}

Properties​

Instance member Data​

Object: The data object sent with postMessage.

Used By​

NameDescription
WebWorkerPostMessageEventHandlerRepresents the method that will handle the PostMessage event.