Skip to content

Instantly share code, notes, and snippets.

@augustovictor
Created March 26, 2017 11:59
Show Gist options
  • Select an option

  • Save augustovictor/3bd2ba77a394a7a595eb5c4c0bebee55 to your computer and use it in GitHub Desktop.

Select an option

Save augustovictor/3bd2ba77a394a7a595eb5c4c0bebee55 to your computer and use it in GitHub Desktop.
// Js classes with extends
// https://jsfiddle.net/2j9fg96b/
class Datastream {
constructor(solution, key) {
this.solution = solution;
this.key = key;
}
toString() {
return `Solution: ${this.solution} | Key: ${this.key}`;
}
}
class GetQueueDS extends Datastream {
constructor(solution, key, props) {
super(solution, key);
this.props = props;
}
toString() {
return super.toString() + `| Props ${JSON.stringify(this.props)}`;
}
exec() {
return `Executing ${this.key} with props: ${JSON.stringify(this.props)}`;
}
}
let props = {
id: '123'
};
const getQueue = new GetQueueDS('sky_at_bko', 'sky_at_bko_ds_get_queue', props);
console.log(getQueue.toString()); //Solution: sky_at_bko | Key: sky_at_bko_ds_get_queue| Props {"id":"123"}
console.log(getQueue.exec()); // Executing sky_at_bko_ds_get_queue with props: {"id":"123"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment