I have three functions in javascript code, one that connects to my mongo database, the other creates a child process and passes the value of database into the phantamjs child process, the third one gets the data from phantomjs and processes it.
I want to make these functions synchronous. is there any specific way of doing so?
This is what i want to do
function connectdb() {
//connects to mongodb and pushes the
//value of emails from database to an array
//also writes the emails into external .txt file
}
function create_child() {
//creates a child phantom process using external .js
//phantom file
//gets data from the child process
}
function process_data() {
//process the data received from create_child()
}
I want these functions to be called synchronously .. connectdb() then create_child() then process_data()