Facilitates tracking of asynchronous jobs.

Hierarchy

  • Events
    • Jobs

Methods

Methods

  • Notifies that a job has finished. The specified job id is removed and the callback stored when the job was started is returned.

    Parameters

    • jobId: string

      The job id

    Returns Function

    The function stored when the job was started

    Example

    const jobId = editor.jobs.start(() => console.log('job was finished'));
    editor.jobs.finish(jobId)(); // prints 'job was finished'
  • Adds a new job. The specified function will be returned when the job is finished.

    Parameters

    • fn: Function

      A function to be stored for this job.

    Returns string

    Returns a job id

    Example

    const jobId = editor.jobs.start(() => console.log('job was finished'));
    editor.jobs.finish(jobId)(); // prints 'job was finished'