diff --git a/pages/develop/legacy/api/javascript/ecore/job.txt b/pages/develop/legacy/api/javascript/ecore/job.txt new file mode 100644 index 000000000..d696ac882 --- /dev/null +++ b/pages/develop/legacy/api/javascript/ecore/job.txt @@ -0,0 +1,47 @@ +===== Javascript binding API - Ecore Job ===== + +[[api:javascript:ecore|Back to the JS Ecore page]] + +**DRAFT** + +The Job module allows queuing work to be done when the current event is dealt with. + +Jobs are processed by the main loop similarly to events. They also will be executed in the order in which they were added. + +A good use for them is when you don't want to execute an action immediately, but want to give the control back to the main loop so that it will call your job callback when jobs start being processed (and if there are other jobs added before yours, they will be processed first). This also gives the chance to other actions in your program to cancel the job before it is started. + +==== Functions and methods ==== + +=== add(callback) === + +Syntax + + + function mycallback() { ... }; + var job = efl.Ecore.Job.add(mycallback); + + +Parameters + + * callback - A function to be called when the job is handled. + +Return value + + * object - An object wrapping the newly added job. + * null - If it was not possible to add the job to the queue. + +Adds a job to the event queue. + + +Once the job has been executed, the job object is invalid. + + +=== job.del() === + +Syntax + + +jobObj.del(); + + +Deletes a job that has not been handled yet. \ No newline at end of file