FaasJS
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security

Documents / @faasjs/workflow / fork

Function: fork()

fork(children): ForkWorkflowInstruction

Mark the current step as waiting and create parallel child branch steps.

Parameters

children

WorkflowStepTarget[]

Child steps to create.

Returns

ForkWorkflowInstruction

Example

import { fork } from '@faasjs/workflow'

async function notifyTeams({ params }) {
  return fork([
    {
      name: 'notifyWarehouse',
      params: {
        orderId: params.orderId,
      },
    },
    {
      name: 'notifyCustomer',
      params: {
        orderId: params.orderId,
      },
    },
  ])
}