Type alias CreateOptions<T>

CreateOptions<T>: {
    executeAt: Date;
    key?: string;
} & (T extends undefined
    ? CreateOptionsDataOptional<T>
    : CreateOptionsDataRequired<T>)

Type Parameters

  • T = undefined

Type declaration

  • executeAt: Date
  • Optional key?: string

    A namespaced unique key (unique to tasks with the same "name")

    If you try to schedule 2 tasks with the same name and key then the latter one will overwrite the first

    An example use case for this could be a "unmute" task, you could use their user id as the key so that only one unmute task is scheduled per user, and if another one is attempted then it will just overwrite the existing one, effectively updating it.

    This also allows you to use deleteByKey and getByKey.

    This is optional.

Generated using TypeDoc