Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.16 KB

pipeline.md

File metadata and controls

47 lines (33 loc) · 1.16 KB

Pipeline

Process of registering, using pipelines.


Table of Contents


Registering

Things to consider:

  • A pipeline is registered when the first pipe is registered with the pipeline name, so to create a pipeline you just have to add a pipe to an non-existing pipeline!
  • A pipe is by default registered at the beginning of the pipeline, to insert it at a diffrent position use the at argument,

With <pipeline-name> being the name to use the pipeline with, callback being the function that passes the value for the next pipe, at being the index to insert the pipe at and the register defining whether to register the pipe if not already registered, we register an pipeline like so:

mediator.register.pipe<T>(
    pipeline-name: string,
    callback: Pipe<T>,
    at = 0
);

Usage

With <pipeline-name> being the name of the pipeline to be used, and the <input> being the input of the pipeline

const result = container.pipe<T>(
    pipeline-name: string,
    input: T
);