Skip to main content
Module

x/gusano/index.ts>Engine

A minimal workflows lib for Deno 🦖
Latest
class Engine
extends EventEmitter
import { Engine } from "https://deno.land/x/gusano@1.0.0/index.ts";

Constructors

new
Engine(blocks: { [id: string]: Block; }, route?: { [id: string]: string | Function; })

Properties

private
optional
actualBlock: Block

The block that will be executed.

private
optional
actualId: string

The ID of the the actual block.

private
endTime: number
private
params: any

Parameters that will be passed to the execution of the actualBlock

private
startTime: number

Millis

Methods

private
emitBlock(
id: string | number | null,
params: any,
result: any,
)
private
getNextId(result: any): Promise<string>

Get next block.

If the next block was defined as a function in the route object, the function is executed with the params of the last runned block.

private
parseParams(args: any): any[]

Parse the params.

The params must are converted to an array.

start(initId: string, ...args: any[])

Start the engine.

interface Engine
import { type Engine } from "https://deno.land/x/gusano@1.0.0/index.ts";

Methods

on(event: "end", listener: (args: { result: any[]; time: number; }) => void): this

It fires when the engine has ended the execution.

on(event: "start", listener: (args: { id: string; params: any[]; result: any[]; }) => void): this

The execution has started.

on(event: "block result", listener: (args: { id: string; params: any[]; result: any[]; }) => void): this

A block has been executed.

on(event: "error", listener: (args: { id: String; params: any[]; error: any; }) => void): this

An error has ocurred.

on(event: string, listener: (args: any) => void): this