Skip to content

1amageek/flow.ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flow.ts

Flow enables coding of structured scripts.

Installation

npm add @1amageek/flow

Usage

class Item implements Flow.Dependency {
    status?: string
}
var item: Item = new Item()

const step0: Flow.Step<Item> = new Flow.Step((item) => {
    // Do something
    return item
})

const step1: Flow.Step<Item> = new Flow.Step( async (item) => {
    try {
        return await asyncFunction()
    } catch(err) {
        // Error handling
        throw(err)
    }
})

const step2: Flow.Step<Item> = new Flow.Step((item) => {
    // Do something
    return item
})

const flow: Flow.Line<Item> = new Flow.Line([step0, step1, step2])

try {
    await flow.run(item)
} catch(error) {
    // Error handling
}   

About

Flow enables coding of structured scripts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published