Options
All
  • Public
  • Public/Protected
  • All
Menu

External module @corpuscule/utils/lib/scheduler

This module provides a solution for scheduling tree-structured tasks where one task could spawn a number of new tasks to complete.

The default purpose of this module is to provide a scheduling system for the web components that could schedule rendering of nested components recursively.

Usage

import schedule from '@corpuscule/utils/lib/scheduler'

Index

Functions

Functions

schedule

  • schedule(task: function): Promise<void>
  • Schedules tree-structured tasks where one task could generate a number of children which execution is also scheduled. Each task is connected to a parent one, and also can have a child and a sibling. Traversing algorithm is depth-first. There are two visits to the node: the first one occurs when the task is going to be performed, and the second one is when we need to resolve or reject the scheduled promise.

    If task execution runs into an error, it rejects all promises from bottom to top.

    Parameters

    • task: function

      function to schedule.

        • (): void
        • Returns void

    Returns Promise<void>

    a Promise which resolves when the task is completed or rejects if there is any error.

Generated using TypeDoc