Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/windmill/node_modules/run-exclusive/dist/lib/runExclusive.d.ts>buildCb

Windmill deno client (separated from the main repo because most of the code is auto-generated from the openapi and not worth committing)
Go to Latest
function buildCb
import { buildCb } from "https://deno.land/x/windmill@v1.92.2/node_modules/run-exclusive/dist/lib/runExclusive.d.ts";

(Read all before using)

The pending of 'build' for creating run exclusive functions that complete via calling a callback function. (Instead of returning a promise).

The only valid reason to use this instead of build() is to be able to retrieve the result and/or release the lock synchronously when it's possible.

If you want the callback to be optional it is possible to define the function as such: const myRunExclusiveFunction = buildCb((callback?)=> { ... }); Anyway you must call it every time and assume it has been defined: callback!(...).

To see if the user has actually provided a callback you can access the hidden property callback.hasCallback.

WARNING: You must also make sure, if you use an optional callback that the argument before it cannot be a function. Be aware that the compiler won't warn you against it. Example: (getLetter:()=> string, callback?:(res:string)=> void)=>{..} is NOT a valid function to pass to buildCb()

WARNING: the source function should NEVER throw exception!

Type Parameters

T extends (...input: any[]) => void

Type Parameters

T extends (...input: any[]) => void

Parameters

groupRef: GroupRef
fun: T