<div dir="ltr">But I still don't understand how the function setTimeout can help you with that. Adding a timeout probably won't solve your problem, it won't cache anything, it will just delay the page unresponsiveness.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 14, 2015 at 2:57 PM Ramon Medeiros <<a href="mailto:ramonn@linux.vnet.ibm.com">ramonn@linux.vnet.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Cristian, nice to see you here :)<br>
<br>
The function getPCIDeviceCompanions tooks almost two second for each
interation. As this function being called each time that the Edit
button is accessed, i want to cache the values on kimchi.main() to
save time.<br>
<br>
On systems that has too much pci devices, a popup from the browser
asks for quit the page by unresponsible script.</div><div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 07/14/2015 09:14 AM, Crístian Viana
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">The function "<span style="font-size:13.1999998092651px;line-height:19.7999992370605px">kimchi.</span><span style="font-size:13.1999998092651px;line-height:19.7999992370605px">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.</span>
<div><span style="font-size:13.1999998092651px;line-height:19.7999992370605px"><br>
</span></div>
<div>Also, why are you using setTimeout at all?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Jul 10, 2015 at 5:57 PM Ramon Medeiros
<<a href="mailto:ramonn@linux.vnet.ibm.com" target="_blank">ramonn@linux.vnet.ibm.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi team,<br>
<br>
i was trying to cache 2 objects, but they came from a HTTP
request, and<br>
took some time to download it. I was unable to use the
function<br>
setTimeout while calling this function:<br>
<br>
kimchi.getPCIDeviceCompanions(kimchi.hostPCIs[i].name,<br>
setTimeout(function(result) {<br>
kimchi.deviceCompanions[kimchi.hostPCIs[i].name] =
result;<br>
},5000));<br>
}<br>
<br>
<br>
The function kimchi.getPCIDeviceCompanions usually takes 2s to
finish.<br>
<br>
--<br>
<br>
Ramon Nunes Medeiros<br>
Kimchi Developer<br>
Linux Technology Center Brazil<br>
IBM Systems & Technology Group<br>
Phone : +55 19 2132 7878<br>
<a href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a><br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a href="mailto:Kimchi-devel@ovirt.org" target="_blank">Kimchi-devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a><br>
</blockquote>
</div>
</blockquote>
<br>
<pre cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a> </pre>
</div></blockquote></div>