cesium-examples/map/3d/static/Cesium/Build/Documentation/TaskProcessor.html

886 lines
55 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TaskProcessor - Cesium Documentation</title>
<!--[if lt IE 9]>
<script src="javascript/html5.js"></script>
<![endif]-->
<link href="styles/jsdoc-default.css" rel="stylesheet">
<link href="styles/prism.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1 class="page-title">
<a href="index.html"><img src="Images/CesiumLogo.png" class="cesiumLogo"></a>
TaskProcessor
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="TaskProcessor">
<a href="#TaskProcessor" class="doc-link"></a>
new Cesium.TaskProcessor<span class="signature">(workerName, <span class="optional">maximumActiveTasks</span>)</span>
<div class="source-link rightLinks">
<a href="https://github.com/AnalyticalGraphicsInc/cesium/blob/1.58/Source/Core/TaskProcessor.js#L211">Core/TaskProcessor.js 211</a>
</div>
</h4>
</div>
<div class="description">
A wrapper around a web worker that allows scheduling tasks for a given worker, returning results asynchronously via a promise. The Worker is not constructed until a task is scheduled.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>workerName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="default">
</td>
<td class="description last">
The name of the worker. This is expected to be a script in the Workers folder.</td>
</tr>
<tr>
<td class="name"><code>maximumActiveTasks</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
<code class="language-javascript">5</code>
</td>
<td class="description last">
<span class="optional">optional</span>
The maximum number of active tasks. Once exceeded, scheduleTask will not queue any more tasks, allowing work to be rescheduled in future frames.</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id="destroy">
<a href="#destroy" class="doc-link"></a>
destroy<span class="signature">()</span>
<div class="source-link rightLinks">
<a href="https://github.com/AnalyticalGraphicsInc/cesium/blob/1.58/Source/Core/TaskProcessor.js#L342">Core/TaskProcessor.js 342</a>
</div>
</h4>
</div>
<div class="description">
Destroys this object. This will immediately terminate the Worker. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a <a href="DeveloperError.html"><code>DeveloperError</code></a> exception.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="initWebAssemblyModule">
<a href="#initWebAssemblyModule" class="doc-link"></a>
initWebAssemblyModule<span class="signature">(<span class="optional">webAssemblyOptions</span>)</span> &rarr; <span class="type-signature returnType">Promise.&lt;Object></span>
<div class="source-link rightLinks">
<a href="https://github.com/AnalyticalGraphicsInc/cesium/blob/1.58/Source/Core/TaskProcessor.js#L291">Core/TaskProcessor.js 291</a>
</div>
</h4>
</div>
<div class="description">
Posts a message to a web worker with configuration to initialize loading and compiling a web assembly module asychronously, as well as an optional fallback JavaScript module to use if Web Assembly is not supported.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>webAssemblyOptions</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<span class="optional">optional</span>
An object with the following properties:
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>modulePath</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
<span class="optional">optional</span>
The path of the web assembly JavaScript wrapper module.</td>
</tr>
<tr>
<td class="name"><code>wasmBinaryFile</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
<span class="optional">optional</span>
The path of the web assembly binary file.</td>
</tr>
<tr>
<td class="name"><code>fallbackModulePath</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
<span class="optional">optional</span>
The path of the fallback JavaScript module to use if web assembly is not supported.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
A promise that resolves to the result when the web worker has loaded and compiled the web assembly module and is ready to process tasks.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="isDestroyed">
<a href="#isDestroyed" class="doc-link"></a>
isDestroyed<span class="signature">()</span> &rarr; <span class="type-signature returnType">Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/AnalyticalGraphicsInc/cesium/blob/1.58/Source/Core/TaskProcessor.js#L332">Core/TaskProcessor.js 332</a>
</div>
</h4>
</div>
<div class="description">
Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a <a href="DeveloperError.html"><code>DeveloperError</code></a> exception.
</div>
<h5>Returns:</h5>
<div class="param-desc">
True if this object was destroyed; otherwise, false.
</div>
<dl class="details">
<h5>See:</h5>
<ul class="see-list">
<li><a href="TaskProcessor.html#destroy">TaskProcessor#destroy</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="scheduleTask">
<a href="#scheduleTask" class="doc-link"></a>
scheduleTask<span class="signature">(parameters, <span class="optional">transferableObjects</span>)</span> &rarr; <span class="type-signature returnType">Promise.&lt;Object>|undefined</span>
<div class="source-link rightLinks">
<a href="https://github.com/AnalyticalGraphicsInc/cesium/blob/1.58/Source/Core/TaskProcessor.js#L247">Core/TaskProcessor.js 247</a>
</div>
</h4>
</div>
<div class="description">
Schedule a task to be processed by the web worker asynchronously. If there are currently more tasks active than the maximum set by the constructor, will immediately return undefined. Otherwise, returns a promise that will resolve to the result posted back by the worker when finished.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>parameters</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
Any input data that will be posted to the worker.</td>
</tr>
<tr>
<td class="name"><code>transferableObjects</code></td>
<td class="type">
<span class="param-type">Array.&lt;Object></span>
</td>
<td class="description last">
<span class="optional">optional</span>
An array of objects contained in parameters that should be transferred to the worker instead of copied.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Either a promise that will resolve to the result when available, or undefined if there are too many active tasks,
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">var taskProcessor = new Cesium.TaskProcessor('myWorkerName'); var promise = taskProcessor.scheduleTask({ someParameter : true, another : 'hello' }); if (!Cesium.defined(promise)) { // too many active tasks - try again later } else { Cesium.when(promise, function(result) { // use the result of the task }); }</code></pre>
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a>
</footer>
</div>
<div class="nav">
<div class="menu">
<input type="text" class="classFilter" id="ClassFilter" placeholder="Search">
<ul id="ClassList"><li data-name="Animation"><a href="Animation.html">Animation</a></li><li data-name="AnimationViewModel"><a href="AnimationViewModel.html">AnimationViewModel</a></li><li data-name="Appearance"><a href="Appearance.html">Appearance</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="ArcType"><a href="ArcType.html">ArcType</a></li><li data-name="AssociativeArray"><a href="AssociativeArray.html">AssociativeArray</a></li><li data-name="AxisAlignedBoundingBox"><a href="AxisAlignedBoundingBox.html">AxisAlignedBoundingBox</a></li><li data-name="barycentricCoordinates"><a href="barycentricCoordinates.html">barycentricCoordinates</a></li><li data-name="BaseLayerPicker"><a href="BaseLayerPicker.html">BaseLayerPicker</a></li><li data-name="BaseLayerPickerViewModel"><a href="BaseLayerPickerViewModel.html">BaseLayerPickerViewModel</a></li><li data-name="Billboard"><a href="Billboard.html">Billboard</a></li><li data-name="BillboardCollection"><a href="BillboardCollection.html">BillboardCollection</a></li><li data-name="BillboardGraphics"><a href="BillboardGraphics.html">BillboardGraphics</a></li><li data-name="BillboardVisualizer"><a href="BillboardVisualizer.html">BillboardVisualizer</a></li><li data-name="binarySearch"><a href="binarySearch.html">binarySearch</a></li><li data-name="BingMapsApi"><a href="BingMapsApi.html">BingMapsApi</a></li><li data-name="BingMapsGeocoderService"><a href="BingMapsGeocoderService.html">BingMapsGeocoderService</a></li><li data-name="BingMapsImageryProvider"><a href="BingMapsImageryProvider.html">BingMapsImageryProvider</a></li><li data-name="BingMapsStyle"><a href="BingMapsStyle.html">BingMapsStyle</a></li><li data-name="BlendEquation"><a href="BlendEquation.html">BlendEquation</a></li><li data-name="BlendFunction"><a href="BlendFunction.html">BlendFunction</a></li><li data-name="BlendingState"><a href="BlendingState.html">BlendingState</a></li><li data-name="BlendOption"><a href="BlendOption.html">BlendOption</a></li><li data-name="BoundingRectangle"><a href="BoundingRectangle.html">BoundingRectangle</a></li><li data-name="BoundingSphere"><a href="BoundingSphere.html">BoundingSphere</a></li><li data-name="BoxEmitter"><a href="BoxEmitter.html">BoxEmitter</a></li><li data-name="BoxGeometry"><a href="BoxGeometry.html">BoxGeometry</a></li><li data-name="BoxGeometryUpdater"><a href="BoxGeometryUpdater.html">BoxGeometryUpdater</a></li><li data-name="BoxGraphics"><a href="BoxGraphics.html">BoxGraphics</a></li><li data-name="BoxOutlineGeometry"><a href="BoxOutlineGeometry.html">BoxOutlineGeometry</a></li><li data-name="CallbackProperty"><a href="CallbackProperty.html">CallbackProperty</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="CameraEventAggregator"><a href="CameraEventAggregator.html">CameraEventAggregator</a></li><li data-name="CameraEventType"><a href="CameraEventType.html">CameraEventType</a></li><li data-name="cancelAnimationFrame"><a href="cancelAnimationFrame.html">cancelAnimationFrame</a></li><li data-name="Cartesian2"><a href="Cartesian2.html">Cartesian2</a></li><li data-name="Cartesian3"><a href="Cartesian3.html">Cartesian3</a></li><li data-name="Cartesian4"><a href="Cartesian4.html">Cartesian4</a></li><li data-name="Cartographic"><a href="Cartographic.html">Cartographic</a></li><li data-name="CartographicGeocoderService"><a href="CartographicGeocoderService.html">CartographicGeocoderService</a></li><li data-name="CatmullRomSpline"><a href="CatmullRomSpline.html">CatmullRomSpline</a></li><li data-name="Cesium3DTile"><a href="Cesium3DTile.html">Cesium3DTile</a></li><li data-name="Cesium3DTileColorBlendMode"><a href="Cesium3DTileColorBlendMode.html">Cesium3DTileColorBlendMode</a></li><li data-name="Cesium3DTileContent"><a href="Cesium3DTileContent.html">Cesium3DTileContent</a></li><li data-name="Cesium3DTileFeature"><a href="Cesium3DTileFeature.html">Cesium3DTileFeature</a></li><li data-name="Cesium3DTilePointFeature"><a href="Cesium3
</div>
</div>
<script>
if (window.frameElement) {
document.body.className = 'embedded';
var ele = document.createElement('a');
ele.className = 'popout';
ele.target = '_blank';
ele.href = window.location.href;
ele.title = 'Pop out';
document.getElementById('main').appendChild(ele);
}
// Set targets on external links. Sandcastle and GitHub shouldn't be embedded in any iframe.
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) {
if (/^https?:/i.test(a.getAttribute('href'))) {
a.target='_blank';
}
});
</script>
<script src="javascript/prism.js"></script>
<script src="javascript/cesiumDoc.js"></script>
</body>
</html>