# Cannot get any value from TaskProcessor.scheduleTask

**URL:** <https://community.cesium.com/t/cannot-get-any-value-from-taskprocessor-scheduletask/16561>\
**Category:** CesiumJS\
**Created:** [December 16, 2021, 10:42am UTC](https://community.cesium.com/t/cannot-get-any-value-from-taskprocessor-scheduletask/16561 "2021-12-16T10:42:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hiroshi\_Yaginuma](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hiroshi_yaginuma/32/10887_2.png) [@Hiroshi\_Yaginuma](https://community.cesium.com/u/Hiroshi_Yaginuma)\
**Post date:** [December 16, 2021, 10:42am UTC](https://community.cesium.com/t/cannot-get-any-value-from-taskprocessor-scheduletask/16561/1 "2021-12-16T10:42:18Z")

</div>

Hi Team,

I’m trying to use Cesium.TaskProcessor.scheduleTask to use web worker that can use Cesium object.

I’m facing issue in getting the resolve value from promise object of Cesium.TaskProcessor.scheduleTask

Tried #1, #2 method below but both failed,  
main.js

```auto
        let worker = new Cesium.TaskProcessor('worker.js');

        let resPromise = worker.scheduleTask({"foo":"bar"}, [this._viewer.scene]);

        console.log("Cesium worker",worker)
        console.log("resPromise",resPromise)

        #1 
        Cesium.when(resPromise,e =>{

            console.log("cesium task1", e)
        });
        #2
        resPromise.then(e=>{
        console.log("cesium task2", e)
        })

```

worker.js

```auto
self.onmessage= function(ev) {
    console.log("workerrrrrrrr, public",ev);

    postMessage("hello from worker");

```

Please give me a working snippet if able.

REF  
[https://cesium.com/learn/cesiumjs/ref-doc/TaskProcessor.html?classFilter=task](https://cesium.com/learn/cesiumjs/ref-doc/TaskProcessor.html?classFilter=task)

```auto
var taskProcessor = new Cesium.TaskProcessor('myWorkerPath');
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
    });
}

```

Thanks in advance,  
Hiroshi
