Skip to content

Instantly share code, notes, and snippets.

@djom202
Last active September 5, 2016 16:42
Show Gist options
  • Select an option

  • Save djom202/83dbfa97dfd43a5fd03bd0e0c5cb596f to your computer and use it in GitHub Desktop.

Select an option

Save djom202/83dbfa97dfd43a5fd03bd0e0c5cb596f to your computer and use it in GitHub Desktop.
A object with a promise of protractor
//***************
// Protractor is global var
//***************
var User = function(){
this.isLogged = function(){
var _defered = protractor.promise.defer();
this.httpRequest(); // Call the http request function
return _defered.promise;
};
this.httpRequest = fucntion(){
// HTTP Petition
// When finished of run the thread and respond the request
_defered.fulfill(_data); // returned the value of the promise
};
};
module.exports = new User();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment