<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Cristian,<br>
<br>
I was trying to do this:<br>
<br>
1) Cache all deviceCompanions in a object, that the key will be the
hostPCI<br>
<br>
2) Query this information when the user enter in guest edit, instead
of download everytime the user enter on this page<br>
<br>
<br>
So, why i am asking about setTimeout?<br>
<br>
I tried to do the operations above and hit an error: The guest_edit
page was unable to get the deviceCompanions because they were not
downloaded, so, i would like to put an timeout (or other function)
to make the function waits for this download, and then, continue to
load kimchi.<br>
<br>
<div class="moz-cite-prefix">On 07/14/2015 11:44 PM, Crístian Viana
wrote:<br>
</div>
<blockquote
cite="mid:CADqiwxzqCvOkX_RhqhhtvPkRdcRSK9DGHoSfXPWXuM65obQdnQ@mail.gmail.com"
type="cite">
<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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a><br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a moz-do-not-send="true"
href="mailto:Kimchi-devel@ovirt.org" target="_blank">Kimchi-devel@ovirt.org</a><br>
<a moz-do-not-send="true"
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 moz-do-not-send="true" href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a> </pre>
</div>
</blockquote>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a class="moz-txt-link-abbreviated" href="mailto:ramonn@br.ibm.com">ramonn@br.ibm.com</a> </pre>
</body>
</html>