industry-chain
v1.0.0
Published
Chain synchronous or async methods using a common parameter namespace.
Downloads
8
Readme
IndustryChain
Chain synchronous or async methods using a common parameter namespace.
Requirements
This extension must be paired with StandardIO and Functions.
Usage
import { factory } from "industry"
import { chain } from "industry-chain"
import { instance } from "industry-instance"
import { functions } from "industry-functions"
import { standard_io } from "industry-standard-io"
class Test {
hello() {
return [
this.getHello,
this.getWorld,
this.log
]
}
getHello() { return { hello: "hello" } }
getWorld({ promise: { resolve } }) {
setTimeout(() => resolve({ world: "world" }), 10)
}
log({ hello, world }) { console.log(`${hello} ${world}`) }
}
let test = factory(Test)
.set("instance", instance)
.set("functions", functions)
.set("standard_io", standard_io)
.set("chain", chain)
test().hello()
// hello world!