Skip to main content

interceptShare

@combeenation/custom-code-utils


Function: interceptShare()

interceptShare(interceptorFn, timeoutMS?): void

This function can be used to call a custom interceptor function before the share is executed.
The share is waiting until the interceptor function has finished or the timeout has elapsed.
This function can only be called once. Every other call will be rejected!

Parameters

interceptorFn

() => Promise<void>

The intercepting function.

timeoutMS?

number

Timeout value in ms.
Original share will be called after this timeout, even interceptor function is still pending.

Returns

void

Example

CfgrUtils.interceptShare(async () => {
await generateScreenshot();
});