Home:ALL Converter>Call a function inside another function

Call a function inside another function

Ask Time:2013-10-31T19:44:10         Author:Sush

Json Formatter

am new to node.js

what i want is to call shedule.schedulejobs inside another function. the following code is for updating some data in to db.i want to call the schedulejob after updatingthe details to database.how it is possible.

    exports.saveJobs = function (jobsCollection, context) {
      console.log(utils.httpBody(context.req));
      var record = utils.httpBody(context.req);  
      var id =record.id;
      var date =record.date;
      jobsCollection.update({ id: record.id}, { $set: record}, { upsert: true }, function (err, result) {
         if (!err) return context.sendJson([], 404);
// i need to call the schedule jobs after performing updation to db
                 schedule.scheduleJob(date, function (id) {
     });
     });

    }

schedule job function

var j = schedule.scheduleJob(date, function(id){
            return function(){
            console.log("inside----------")
            console.log(id)
            };

            }(id));

Author:Sush,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/19705637/call-a-function-inside-another-function
yy