本文整理汇总了C#中Worker.postMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Worker.postMessage方法的具体用法?C# Worker.postMessage怎么用?C# Worker.postMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worker
的用法示例。
在下文中一共展示了Worker.postMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WorkerScoreRenderer
public WorkerScoreRenderer(JsWorkerApi workerApi, dynamic rawSettings)
{
_workerApi = workerApi;
string atRoot = rawSettings.atRoot;
if (atRoot != "" && !atRoot.EndsWith("/"))
{
atRoot += "/";
}
_atRoot = atRoot;
_worker = new Worker(atRoot + "AlphaTab.worker.js");
var root = new StringBuilder();
root.Append(window.location.protocol);
root.Append("//");
root.Append(window.location.hostname);
if (window.location.port.As<bool>())
{
root.Append(":");
root.Append(window.location.port);
}
root.Append(_atRoot);
_worker.postMessage(new { cmd = "initialize", root = root.ToString(), settings = rawSettings });
_worker.addEventListener("message", HandleWorkerMessage, false);
}
示例2: WorkerScoreRenderer
public WorkerScoreRenderer(Settings settings)
{
_worker = new Worker(CreateWorkerUrl());
_worker.postMessage(new { cmd = "initialize", settings = settings.ToJson() });
_worker.addEventListener("message", HandleWorkerMessage, false);
}