UNPKG

qcobjects-docs

Version:

The official app and website for documentation of QCObjects

33 lines (27 loc) 798 B
### serviceLoader Loads a service instance and returns a promise that is resolved when the service has a successful response load and is rejected when it fails loading the response. #### Usage: ```javascript [Promise] serviceLoader(serviceInstance) ``` #### Example: ```javascript class MyTestService extends Service { name = 'myservice'; external = true; cached = false; method = 'GET'; headers = {'Content-Type':'application/json'}; url = 'https://api.github.com/orgs/QuickCorp/repos'; withCredentials:false; } var service = serviceLoader(New(MyTestService,{ data:{param1:1} })).then( (successfulResponse)=>{ // This will show the service response as a plain text console.log(successfulResponse.service.template); }, (failedResponse)=>{ }); ```