when you call the javascript function you get back from the template, you 
have to pass it the parameters you want called on it.  Or am I 
misunderstanding your question?

On Tuesday, May 23, 2017 at 4:52:51 PM UTC-7, Patrik Laszlo wrote:
>
> Hi! 
>
> How are you?
> This works, async function:
>
> static void WorkAsync(uv_work_t *req) {
>     Work *work = static_cast<Work *>(req->data);
>
>     int i = 0;
>     while(work->running) {
>         //sleep(1);
>         usleep(1000 * 1000 * 0.25);
>         cout << i++ << endl;
>     }
>     work->result = "Async task processed.";
> }
>
>
>
> I can return in my addon, a cancel callback. Callad CancelFunction.
> I would like to set work->running = false, so it stops computing.
> But with FunctionTempalte. I cannot give a pointer :) How can I do it?
>
> Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, CancelFunction);
> Local<Function> fn = tpl->GetFunction();
>
>
> I can work it, by I cannot pass a pointer to the work . Is it easy?
>
> Thanks so much!
> Bye!
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to