4
votes

I'm not sure if I'm understanding this correctly, do I need to create a function like this:

function execute(callback) {
    gapi.client.load('drive', 'v2', function() {
      callback();
    });
}

And then for all my calls call it like this?

function retrieveAllFiles() {
    execute(function(){
      var request = gapi.client.drive.files.list();
      request.execute(function(resp) { 
          console.log(resp);
      }
    }
}

function deletefile() {
    execute(function(){ 
    ...

It works fine but I'm not sure if this is the correct way of doing it?

1
This was very helpful in fixing all the Undefined file type errors I was getting - Aspen

1 Answers

2
votes

Yes, that is probably the easiest way to do it. It is certainly an acceptable way.