Manual Reference Source Test
import Cron from 'pop-api-scraper/src/Cron.js'
public class | source

Cron

Cron class for executing the scraper periodically.

Test:

Constructor Summary

Public Constructor
public

constructor(PopApi: PopApi, options: Object)

Create a new Cron object.

Member Summary

Public Members
public

The cron time for scraping audios.

Method Summary

Public Methods
public

getCron(PopApi: PopApi, start: boolean): Object

Get the cron job to run.

Public Constructors

public constructor(PopApi: PopApi, options: Object) source

Create a new Cron object.

Params:

NameTypeAttributeDescription
PopApi PopApi
  • nullable: false

The PopApi instance.

options Object
  • optional
  • default: {}
  • nullable: false

The options for the Cron middleware.

options.cronTime string
  • optional
  • default: 0 0 *\/6 * * *
  • nullable: false

The cron tab to execute the scraper.

options.start boolean
  • optional
  • default: false
  • nullable: true

Start the cronjob on creation.

Test:

Public Members

public cronTime: string source

The cron time for scraping audios. Default is 0 0 *\/6 * * *.

Public Methods

public getCron(PopApi: PopApi, start: boolean): Object source

Get the cron job to run.

Params:

NameTypeAttributeDescription
PopApi PopApi
  • nullable: false

The PopApi instance.

start boolean
  • optional
  • nullable: true

Start the cron job.

Return:

Object

A configured cron job.

Test: