Skip to content

Instantly share code, notes, and snippets.

@catarak
Created April 25, 2017 16:17
Show Gist options
  • Save catarak/685cec167e73a2bb621dcec53b9c734f to your computer and use it in GitHub Desktop.
Save catarak/685cec167e73a2bb621dcec53b9c734f to your computer and use it in GitHub Desktop.
// An example of one of our microservices - handles importing to Elasticsearch
class ESCollection extends UpdateEmitter {
get status() {
// should return a JSON object which is passed along with the websocket event
}
syncESWithCSV(csvName) {
this.started(); // emits 'started' event to any front-end listening for it
// do stuff to load CSV to Elasticsearch
this.progress(); // emits 'progress' event with the status
// do more stuff
this.completed; // emits 'completed' event
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment