Skip to main content

Home > @jsplumb/util > wrap

wrap() function#

Wraps one function with another, creating a placeholder for the wrapped function if it was null. This is used to wrap the various drag/drop event functions - to allow jsPlumb to be notified of important lifecycle events without imposing itself on the user's drag/drop functionality.


export declare function wrap(wrappedFunction: Function, newFunction: Function, returnOnThisValue?: any): () => any;


wrappedFunctionFunctionoriginal function to wrap; may be null.
newFunctionFunctionfunction to wrap the original with.
returnOnThisValueanyOptional. Indicates that the wrappedFunction should not be executed if the newFunction returns a value matching 'returnOnThisValue'. note that this is a simple comparison and only works for primitives right now.


() => any