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

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

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 buildMethodCb
import { buildMethodCb } from "https://deno.land/x/windmill@v1.361.1/node_modules/run-exclusive/dist/lib/runExclusive.d.ts";

(Read all before using)

Pending of 'buildMethod' for function that return with callback instead of promise.

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 buildMethodCb()

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