Custom job execute function now receives the job as an argument

This commit is contained in:
Stefan Persson 2011-01-11 15:28:59 +00:00
parent 0d54d224e1
commit a156408c78
2 changed files with 2 additions and 2 deletions

View file

@ -148,7 +148,7 @@ function loadJobs(){
//ID = ID for storage
//Key is position in list, returned from "addJob"
var execFunc = function(){ print("Custom execute function running"); return 42; };
var execFunc = function(job){ print("Custom execute function running"); print("Job: " + job.v.name); return 42; };
var newRecurringMonthJob = getJob({id: 4, executeFunc: execFunc, name: "testnamn14", type: com.telldus.scheduler.JOBTYPE_ABSOLUTE, startdate: startdate1, lastRun: 0, device: 1, method: 1, value: ""});
newRecurringMonthJob.addEvent(new Event({id: 0, value: "", fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 10, time: (new Date().getTime())/1000 + 20}));
com.telldus.scheduler.addJob(newRecurringMonthJob);

View file

@ -283,7 +283,7 @@ com.telldus.scheduler.Job.prototype.execute = function(){
//may be overridden if other than device manipulation should be performed
var success = 0;
if(this.v.executeFunc != null){
success = this.v.executeFunc();
success = this.v.executeFunc(this);
this.updateJobLastRun();
return success;
}