Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Job

Hierarchy

Index

Constructors

constructor

Properties

Protected e

Protected id

id: string

Protected lifeCycle

lifeCycle: LifeEvent[]

Protected locallyAvailable

locallyAvailable: boolean

Protected name

name: string

Protected nest

nest: Nest

Protected tunnel

tunnel: Tunnel

Methods

Protected createLifeEvent

  • createLifeEvent(verb: string, start: string, finish: string): void
  • Create a new life event.

    Parameters

    • verb: string
    • start: string
    • finish: string

    Returns void

email

  • Sends an email.

    Parameters

    • emailOptions: EmailOptions

      Email options

      Sending pug template email example

      // my_tunnel.js
      tunnel.run(function (job, nest) {
           job.email({
               subject: "Test email from pug template",
               to: "john.smith@example.com",
               template: "./template_files/my_email.pug"
           });
      });
      
      // template_files/my_email.pug
      h1="Example email!"
      p="Got job ID " + job.getId()
      

      Sending plain-text email

      tunnel.run(function (job, nest) {
           job.email({
               subject: "Test email with hard-coded plain-text",
               to: "john.smith@example.com",
               text: "My email body!"
           });
      });
      

      Sending html email

      tunnel.run(function (job, nest) {
           job.email({
               subject: "Test email with hard-coded html",
               to: "john.smith@example.com",
               html: "<h1>My email body!</h1>"
           });
      });
      

    Returns void

fail

  • fail(reason: string): void
  • Function to call to fail a job while in a tunnel.

    Parameters

    • reason: string

    Returns void

getId

  • getId(): string

getLifeCycle

getName

  • getName(): string

getNameProper

  • getNameProper(): string

getNest

getTunnel

isLocallyAvailable

  • isLocallyAvailable(): boolean

move

  • move(destinationNest: any, callback: any): void
  • Move function error.

    Parameters

    • destinationNest: any
    • callback: any

    Returns void

setLocallyAvailable

  • setLocallyAvailable(available: boolean): void
  • Set if the job is locally available.

    Parameters

    • available: boolean

    Returns void

setName

  • setName(name: string): void

setNest

  • setNest(nest: Nest): void

setTunnel

  • setTunnel(tunnel: Tunnel): void

toString

  • toString(): string

transfer

  • transfer(tunnel: Tunnel): void

Generated using TypeDoc