[Kimchi-devel] [DOUBT] How to use setTimeout correctly

Crístian Viana cristiandeives at gmail.com
Tue Jul 14 12:14:55 UTC 2015


The function "kimchi.getPCIDeviceCompanions" (and most other Kimchi
JavaScript functions, actually) receives a callback function which receives
a result parameter. That function should be executed when the result is
ready. In your case, your parameter function doesn't match this requirement
(i.e. you're passing a function which receives a function which receives a
parameter). You need to pass parameters exactly as they're expected by the
main function.

Also, why are you using setTimeout at all?

On Fri, Jul 10, 2015 at 5:57 PM Ramon Medeiros <ramonn at linux.vnet.ibm.com>
wrote:

> Hi team,
>
> i was trying to cache 2 objects, but they came from a HTTP request, and
> took some time to download it. I was unable to use the function
> setTimeout while calling this function:
>
>      kimchi.getPCIDeviceCompanions(kimchi.hostPCIs[i].name,
> setTimeout(function(result) {
>          kimchi.deviceCompanions[kimchi.hostPCIs[i].name] = result;
>      },5000));
> }
>
>
> The function kimchi.getPCIDeviceCompanions usually takes 2s to finish.
>
> --
>
> Ramon Nunes Medeiros
> Kimchi Developer
> Linux Technology Center Brazil
> IBM Systems & Technology Group
> Phone : +55 19 2132 7878
> ramonn at br.ibm.com
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20150714/8b9ee996/attachment.html>


More information about the Kimchi-devel mailing list