mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
add transformers to file helpers (#2922)
* fix undefined handling in INI * beta.14 * Partial -> DeepPartial in action request * boolean laziness kills * beta.16 * misc fixes * file transformers * infer validator source argument * simplify validator * readd toml * beta.17 * filter undefined instead of parse/stringify * handle arrays of objects in filterUndefined
This commit is contained in:
@@ -35,10 +35,15 @@ export class CallbackHolder {
|
||||
}
|
||||
child(name: string): CallbackHolder {
|
||||
this.removeChild(name)
|
||||
const child = new CallbackHolder()
|
||||
const child = new CallbackHolder(this.effects)
|
||||
this.children.set(name, child)
|
||||
return child
|
||||
}
|
||||
|
||||
getChild(name: string): CallbackHolder | null {
|
||||
return this.children.get(name) || null
|
||||
}
|
||||
|
||||
removeChild(name: string) {
|
||||
const child = this.children.get(name)
|
||||
if (child) {
|
||||
@@ -60,7 +65,9 @@ export class CallbackHolder {
|
||||
callCallback(index: number, args: any[]): Promise<unknown> {
|
||||
const callback = this.getCallback(index)
|
||||
if (!callback) return Promise.resolve()
|
||||
return Promise.resolve().then(() => callback(...args))
|
||||
return Promise.resolve()
|
||||
.then(() => callback(...args))
|
||||
.catch((e) => console.error("callback failed", e))
|
||||
}
|
||||
onLeaveContext(fn: Function) {
|
||||
this.onLeaveContextCallbacks.push(fn)
|
||||
|
||||
Reference in New Issue
Block a user