Class Functions

Index

Methods

Methods

public static alias(object?: any, methodName?: string): any

[Method] Create an alias to the provided method property with name methodName of object

Parameters

  • object?: any optional

    Object/Function

  • methodName?: string optional

    String

Returns

any

Function aliasFn

public static bind(fn?: any, scope?: any, args?: Array<any>, appendArgs?: any): any

[Method] Create a new function from the provided fn change this to the provided scope optionally overrides arguments for the

Parameters

  • fn?: any optional

    Function The function to delegate.

  • scope?: any optional

    Object The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.

  • args?: Array<any> optional

    Array Overrides arguments for the call. (Defaults to the arguments passed by the caller)

  • appendArgs?: any optional

    Boolean/Number if true args are appended to call args instead of overriding, if a number the args are inserted at the specified position.

Returns

any

Function The new function.

public static clone(method?: any): any

[Method] Create a clone of the provided method

Parameters

  • method?: any optional

    Function

Returns

any

Function cloneFn

public static createBuffered(fn?: any, buffer?: number, scope?: any, args?: Array<any>): any

[Method] Creates a delegate function optionally with a bound scope which when called buffers the execution of the passed fu

Parameters

  • fn?: any optional

    Function The function to invoke on a buffered timer.

  • buffer?: number optional

    Number The number of milliseconds by which to buffer the invocation of the function.

  • scope?: any optional

    Object The scope (this reference) in which the passed function is executed. If omitted, defaults to the scope specified by the caller.

  • args?: Array<any> optional

    Array Override arguments for the call. Defaults to the arguments passed by the caller.

Returns

any

Function A function which invokes the passed function after buffering for the specified time.

public static createDelayed(fn?: any, delay?: number, scope?: any, args?: Array<any>, appendArgs?: any): any

[Method] Creates a delegate callback which when called executes after a specific delay

Parameters

  • fn?: any optional

    Function The function which will be called on a delay when the returned function is called. Optionally, a replacement (or additional) argument list may be specified.

  • delay?: number optional

    Number The number of milliseconds to defer execution by whenever called.

  • scope?: any optional

    Object The scope (this reference) used by the function at execution time.

  • args?: Array<any> optional

    Array Override arguments for the call. (Defaults to the arguments passed by the caller)

  • appendArgs?: any optional

    Boolean/Number if True args are appended to call args instead of overriding, if a number the args are inserted at the specified position.

Returns

any

Function A function which, when called, executes the original function after the specified delay.

public static createDelegate(fn?: any, scope?: any, args?: Array<any>, appendArgs?: any): any

[Method] Create a new function from the provided fn change this to the provided scope optionally overrides arguments for the

Parameters

  • fn?: any optional

    Function The function to delegate.

  • scope?: any optional

    Object The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.

  • args?: Array<any> optional

    Array Overrides arguments for the call. (Defaults to the arguments passed by the caller)

  • appendArgs?: any optional

    Boolean/Number if true args are appended to call args instead of overriding, if a number the args are inserted at the specified position.

Returns

any

Function The new function.

public static createInterceptor(origFn?: any, newFn?: any, scope?: any, returnValue?: any): any

[Method] Creates an interceptor function

Parameters

  • origFn?: any optional

    Function The original function.

  • newFn?: any optional

    Function The function to call before the original.

  • scope?: any optional

    Object The scope (this reference) in which the passed function is executed. If omitted, defaults to the scope in which the original function is called or the browser window.

  • returnValue?: any optional

    Object The value to return if the passed function return false.

Returns

any

Function The new function.

public static createSequence(originalFn?: any, newFn?: any, scope?: any): any

[Method] Create a combined function call sequence of the original function the passed function

Parameters

  • originalFn?: any optional

    Function The original function.

  • newFn?: any optional

    Function The function to sequence.

  • scope?: any optional

    Object The scope (this reference) in which the passed function is executed. If omitted, defaults to the scope in which the original function is called or the browser window.

Returns

any

Function The new function.

public static createThrottled(fn?: any, interval?: number, scope?: any): any

[Method] Creates a throttled version of the passed function which when called repeatedly and rapidly invokes the passed func

Parameters

  • fn?: any optional

    Function The function to execute at a regular time interval.

  • interval?: number optional

    Number The interval, in milliseconds, on which the passed function is executed.

  • scope?: any optional

    Object The scope (this reference) in which the passed function is executed. If omitted, defaults to the scope specified by the caller.

Returns

any

Function A function which invokes the passed function at the specified interval.

public static defer(fn?: any, millis?: number, scope?: any, args?: Array<any>, appendArgs?: any): number

[Method] Calls this function after the number of milliseconds specified optionally in a specific scope

Parameters

  • fn?: any optional

    Function The function to defer.

  • millis?: number optional

    Number The number of milliseconds for the setTimeout() call. If less than or equal to 0 the function is executed immediately.

  • scope?: any optional

    Object The scope (this reference) in which the function is executed. If omitted, defaults to the browser window.

  • args?: Array<any> optional

    Array Overrides arguments for the call. Defaults to the arguments passed by the caller.

  • appendArgs?: any optional

    Boolean/Number if true, args are appended to call args instead of overriding, if a number the args are inserted at the specified position.

Returns

number

Number The timeout id that can be used with clearTimeout().

public static flexSetter(fn?: any): any

[Method] A very commonly used method throughout the framework

Parameters

  • fn?: any optional

    Function

Returns

any

Function flexSetter

public static interceptAfter(object?: any, methodName?: string, fn?: any, scope?: any): any

[Method] Adds behavior to an existing method that is executed after the original behavior of the function

Parameters

  • object?: any optional

    Object The target object

  • methodName?: string optional

    String Name of the method to override

  • fn?: any optional

    Function Function with the new behavior. It will be called with the same arguments as the original method. The return value of this function will be the return value of the new method.

  • scope?: any optional

    Object The scope to execute the interceptor function. Defaults to the object.

Returns

any

Function The new function just created.

public static interceptBefore(object?: any, methodName?: string, fn?: any, scope?: any): any

[Method] Adds behavior to an existing method that is executed before the original behavior of the function

Parameters

  • object?: any optional

    Object The target object

  • methodName?: string optional

    String Name of the method to override

  • fn?: any optional

    Function Function with the new behavior. It will be called with the same arguments as the original method. The return value of this function will be the return value of the new method.

  • scope?: any optional

    Object The scope to execute the interceptor function. Defaults to the object.

Returns

any

Function The new function just created.

public static pass(fn?: any, args?: Array<any>, scope?: any): any

[Method] Create a new function from the provided fn the arguments of which are pre set to args

Parameters

  • fn?: any optional

    Function The original function.

  • args?: Array<any> optional

    Array The arguments to pass to new callback.

  • scope?: any optional

    Object The scope (this reference) in which the function is executed.

Returns

any

Function The new callback function.