examples/make_droplet.js
function pollUntilDone(id, done) {
  client.droplets.get(id, function(err, droplet) {
    if (!err && droplet.locked === false) {
      // we're done!
      done.call();
    } else if (!err && droplet.locked === true) {
      // back off 10s more
      setTimeout(function() {
        pollUntilDone(id, done);
      }, (10 * 1000));
    } else {
      pollUntilDone(id, done);
    }
  });
}
function pollUntilDone(id, done) {
  client.droplets.get(id, function(err, droplet) {
    if (!err && droplet.locked === false) {
      // we're done!
      done.call();
    } else if (!err && droplet.locked === true) {
      // back off 10s more
      setTimeout(function() {
        pollUntilDone(id, done);
      }, (10 * 1000));
    } else {
      pollUntilDone(id, done);
    }
  });
}
function pollUntilDone ( id , done ) { client . droplets . get ( id , function ( err , droplet ) { if ( ! err && droplet . locked === false ) { // we're done! done . call ( ) ; } else if ( ! err && droplet . locked === true ) { // back off 10s more setTimeout ( function ( ) { pollUntilDone ( id , done ) ; } , ( 10 * 1000 ) ) ; } else { pollUntilDone ( id , done ) ; } } ) ; }
Poll for non-locked state every 10s
Poll for non - locked state every 10s