WebWorkerPostMessageEventArgs
Namespace: Wisej.Ext.WebWorker
Assembly: Wisej.Ext.WebWorker (4.1.0.0)
Provides data for the PostMessage event.
- C#
- VB.NET
public class WebWorkerPostMessageEventArgs : EventArgs
Public Class WebWorkerPostMessageEventArgs
Inherits 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
WebWorkerPostMessageEventArgs(e)
Initializes a new instance of WebWorkerPostMessageEventArgs from the specified event data.
| Name | Type | Description |
|---|---|---|
| e | WisejEventArgs | An 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
Data
Object: The data object sent with postMessage.
Used By
| Name | Description |
|---|---|
| WebWorkerPostMessageEventHandler | Represents the method that will handle the PostMessage event. |