Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 132: Line 132:
  if(simulations[simid].running)
  if(simulations[simid].running)
  {
  {
-
   //TODO STOP
+
   window.clearTimeout(simulations[simid].timeout);
   simulations[simid].running= false;
   simulations[simid].running= false;
   btn.innerHTML= 'PLAY';
   btn.innerHTML= 'PLAY';
Line 138: Line 138:
  else
  else
  {
  {
-
  //TODO START
 
   for(var i= 0 ; i < simulations[simid].molecules.length ; ++i)
   for(var i= 0 ; i < simulations[simid].molecules.length ; ++i)
   {
   {
Line 155: Line 154:
   simulations[simid].running= true;
   simulations[simid].running= true;
   btn.innerHTML= 'PAUSE';
   btn.innerHTML= 'PAUSE';
 +
  simulations[simid].timeout= setTimeout(function() {simbox_refresh(simid);}, 100);
  }
  }
  simbox_update_controls(simid);
  simbox_update_controls(simid);
Line 163: Line 163:
{
{
  //TODO STOP
  //TODO STOP
 +
window.clearTimeout(simulations[simid].timeout);
  simulations[simid].running= false;
  simulations[simid].running= false;
  document.getElementById('simbox_start_'+simid).innerHTML= 'PLAY';
  document.getElementById('simbox_start_'+simid).innerHTML= 'PLAY';

Revision as of 22:18, 2 August 2013