All communication to DroneDeploy is available by instantiating the global api object
new DroneDeploy({version: 1}).then(function(dronedeployApi){console.log(dronedeployApi);})
You can listen to the result of any dronedeployApi
call via promises.
new DroneDeploy({version: 1}).then(function(dronedeployApi){dronedeployApi.Class.method(exampleParameter).then(function(response){console.log(response);}, function(error){console.log(error);});});
You can listen to the result of any call via promises.
dronedeployApi.Class.method(exampleParameter).then(function(response){console.log(response);}, function(error){console.log(error);});
Note: The promise polyfill is loaded into every app. Read More about Promises​
If you are subscribing to a stream of data and want to receive multiple values you should use .subscribe
.
new DroneDeploy({version: 1}).then(function(dronedeployApi){dronedeployApi.Class.method(exampleParameter).subscribe(function(result){ console.log(result)},function(error){ console.log(error)},function(){ console.log('complete')});});
Note: This pattern is inspired by rxjs, but rxjs is not loaded into apps.