Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Example Usage

Each task should have an entry in the tmp_cron_tasks table of your StarbaseDB instance. An example row might look like:

{
    "name": "Even minutes",
    "cron_tab": "*/2 * * * *",
    "payload": "",
    "callback_host": "https://starbasedb-{MY-IDENTIFIER}.workers.dev"
}

Then your code in your /src/index.ts would implement the plugin setup like below:

import { CronPlugin } from '../plugins/cron'

// ....
// ....

const cronPlugin = new CronPlugin()
cronPlugin.onEvent(({ name, cron_tab, payload }) => {
    console.log('CRON EVENT: ', name, cron_tab, payload)

    if (name === 'Even minutes') {
        console.log('Payload: ', JSON.stringify(payload))
    }
}, ctx)

const plugins = [
    // ...
    cronPlugin,
] satisfies StarbasePlugin[]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.