Skip to content

Instantly share code, notes, and snippets.

@dimaqw
Last active December 13, 2017 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimaqw/a444e0cbe5ad54d917a2b98569d41c1b to your computer and use it in GitHub Desktop.
Save dimaqw/a444e0cbe5ad54d917a2b98569d41c1b to your computer and use it in GitHub Desktop.
class BaseClass {
constructor() {
return {
baseRequest: this.baseRequest.bind(this),
postRequest: this.postRequest.bind(this),
};
}
baseRequest(url) {
this.log(`baseRequest: ${url}`);
}
postRequest(url) {
this.log(`postRequest: ${url}`);
}
getRequest(url) {
this.log(`getRequest: ${url}`);
}
log(msg){
console.log(msg);
}
}
module.exports = BaseClass;
const myClass = new BaseClass();
myClass.baseRequest('https://www.google.com','jwt'); //baseRequest: https://www.google.com
myClass.getRequest('https://www.google.com','jwt'); //error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment