Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Callable

  • JQueryStatic(window: Window, discriminator: boolean): JQueryStatic
  • JQueryStatic<TElement>(html: string, ownerDocument_attributes?: Document | PlainObject<any>): JQuery<TElement>
  • JQueryStatic<TElement>(selector: string, context?: string | Element | JQuery<HTMLElement> | Document): JQuery<TElement>
  • JQueryStatic(element: HTMLSelectElement): JQuery<HTMLSelectElement>
  • JQueryStatic<T>(element_elementArray: T | ArrayLike<T>): JQuery<T>
  • JQueryStatic<T>(selection: JQuery<T>): JQuery<T>
  • JQueryStatic<TElement>(callback: ((this: Document, $: JQueryStatic) => void)): JQuery<TElement>
  • JQueryStatic<T>(object: T): JQuery<T>
  • JQueryStatic<TElement>(): JQuery<TElement>
  • Parameters

    • window: Window
    • discriminator: boolean

    Returns JQueryStatic

  • Creates DOM elements on the fly from the provided string of raw HTML.

    see

    ``

    since

    1.0

    since

    1.4

    example

    ​ ````Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup.

    $( "<div><p>Hello</p></div>" ).appendTo( "body" )
    
    example

    ​ ````Create some DOM elements.

    $( "<div/>", {
    "class": "test",
    text: "Click me!",
    click: function() {
    $( this ).toggleClass( "test" );
    }
    })
    .appendTo( "body" );

    Type Parameters

    • TElement extends HTMLElement = HTMLElement

    Parameters

    • html: string

      @param html

      • html (ownerDocument) — A string of HTML to create on the fly. Note that this parses HTML, not XML.
      • html (attributes) — A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).
    • Optional ownerDocument_attributes: Document | PlainObject<any>

      @param ownerDocument_attributes

      • ownerDocument — A document in which the new elements will be created.
      • attributes — An object of attributes, events, and methods to call on the newly-created element.

    Returns JQuery<TElement>

  • Accepts a string containing a CSS selector which is then used to match a set of elements.

    see

    ``

    since

    1.0

    example

    ​ ````Find all p elements that are children of a div element and apply a border to them.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p>one</p>
    <div><p>two</p></div>
    <p>three</p>

    <script>
    $( "div > p" ).css( "border", "1px solid gray" );
    </script>
    </body>
    </html>
    example

    ​ ````Find all inputs of type radio within the first form in the document.

    $( "input:radio", document.forms[ 0 ] );
    
    example

    ​ ````Find all div elements within an XML document from an Ajax response.

    $( "div", xml.responseXML );
    

    Type Parameters

    • TElement extends Element = HTMLElement

    Parameters

    • selector: string

      A string containing a selector expression

    • Optional context: string | Element | JQuery<HTMLElement> | Document

      A DOM Element, Document, Selector or jQuery to use as context

    Returns JQuery<TElement>

  • Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

    see

    ``

    since

    1.0

    example

    ​ ````Set the background color of the page to black.

    $( document.body ).css( "background", "black" );
    

    Parameters

    • element: HTMLSelectElement

      A DOM element to wrap in a jQuery object.

    Returns JQuery<HTMLSelectElement>

  • Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

    see

    ``

    since

    1.0

    example

    ​ ````Set the background color of the page to black.

    $( document.body ).css( "background", "black" );
    
    example

    ​ ````Hide all the input elements within a form.

    $( myForm.elements ).hide();
    

    Type Parameters

    • T extends Element

    Parameters

    • element_elementArray: T | ArrayLike<T>

      @param element_elementArray

      • element — A DOM element to wrap in a jQuery object.
      • elementArray — An array containing a set of DOM elements to wrap in a jQuery object.

    Returns JQuery<T>

  • Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

    see

    ``

    since

    1.0

    Type Parameters

    • T

    Parameters

    • selection: JQuery<T>

      An existing jQuery object to clone.

    Returns JQuery<T>

  • Binds a function to be executed when the DOM has finished loading.

    see

    ``

    since

    1.0

    example

    ​ ````Execute the function when the DOM is ready to be used.

    $(function() {
    // Document is ready
    });
    example

    ​ ````Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.

    jQuery(function( $ ) {
    // Your code using failsafe $ alias here...
    });

    Type Parameters

    • TElement = HTMLElement

    Parameters

    • callback: ((this: Document, $: JQueryStatic) => void)

      The function to execute when the DOM is ready.

    Returns JQuery<TElement>

  • Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.

    see

    ``

    since

    1.0

    Type Parameters

    Parameters

    • object: T

      A plain object to wrap in a jQuery object.

    Returns JQuery<T>

  • Returns an empty jQuery set.

    see

    ``

    since

    1.4

    Type Parameters

    • TElement = HTMLElement

    Returns JQuery<TElement>

Index

Properties

Animation: AnimationStatic
Callbacks: CallbacksStatic
Deferred: DeferredStatic
Widget: Widget
ajaxSettings: AjaxSettings<any>
see

``

deprecated

​ Deprecated. Use ``.

Contains information about the current browser environment, such as which browser the user is using etc.

cssHooks: CSSHooks

Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.

see

``

since

1.4.3

cssNumber: PlainObject<boolean>

An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values.

see

``

since

1.4.3

datepicker: Datepicker
easing: Easings
see

``

expr: Selectors
fn: JQuery<HTMLElement>

The global settings for the jQuery Hotkeys plugin.

Namespace in the static jQuery object for plugins written by Keith Wood, see http://keith-wood.name/

Keypad related constants and utility method available on the $.keypad object.

A Promise-like object (or "thenable") that resolves when the document is ready.

see

``

since

1.8

example

​ ````Listen for document ready using jQuery.when.

$.when( $.ready ).then(function() {
// Document is ready.
});
example

​ ````Typical usage involving another promise, using jQuery.when.

$.when(
$.getJSON( "ajax/test.json" ),
$.ready
).done(function( data ) {
// Document is ready.
// Value of test.json is passed as `data`.
});
support: PlainObject<any>

A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.

see

``

since

1.3

deprecated

​ Deprecated since 1.9. See ``.

timepicker: Timepicker

The global instance of the timepicker utility class for working with times.

timers: TickFunction<any>[]
ui: UI
valHooks: ValHooks
widget: Widget

Methods

  • Perform an asynchronous HTTP (Ajax) request.

    see

    ``

    since

    1.5

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • Optional settings: AjaxSettings<any>

      A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings.

    Returns jqXHR<any>

  • Perform an asynchronous HTTP (Ajax) request.

    see

    ``

    since

    1.0

    example

    ​ ````Save some data to the server and notify the user once it's complete.

    $.ajax({
    method: "POST",
    url: "some.php",
    data: { name: "John", location: "Boston" }
    })
    .done(function( msg ) {
    alert( "Data Saved: " + msg );
    });
    example

    ​ ````Retrieve the latest version of an HTML page.

    $.ajax({
    url: "test.html",
    cache: false
    })
    .done(function( html ) {
    $( "#results" ).append( html );
    });
    example

    ​ ````Send an xml document as data to the server. By setting the processData option to false, the automatic conversion of data to strings is prevented.

    var xmlDocument = [create xml document];
    var xmlRequest = $.ajax({
    url: "page.php",
    processData: false,
    data: xmlDocument
    });

    xmlRequest.done( handleResponse );
    example

    ​ ````Send an id as data to the server, save some data to the server, and notify the user once it's complete. If the request fails, alert the user.

    var menuId = $( "ul.nav" ).first().attr( "id" );
    var request = $.ajax({
    url: "script.php",
    method: "POST",
    data: { id : menuId },
    dataType: "html"
    });

    request.done(function( msg ) {
    $( "#log" ).html( msg );
    });

    request.fail(function( jqXHR, textStatus ) {
    alert( "Request failed: " + textStatus );
    });
    example

    ​ ````Load and execute a JavaScript file.

    $.ajax({
    method: "GET",
    url: "test.js",
    dataType: "script"
    });

    Parameters

    • Optional settings: AjaxSettings<any>

      A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().

    Returns jqXHR<any>

  • Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().

    see

    ``

    since

    1.5

    Parameters

    • dataTypes: string

      An optional string containing one or more space-separated dataTypes

    • handler: ((options: AjaxSettings<any>, originalOptions: AjaxSettings<any>, jqXHR: jqXHR<any>) => string | void)

      A handler to set default values for future Ajax requests.

    Returns void

  • Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().

    see

    ``

    since

    1.5

    Parameters

    Returns void

  • Set default values for future Ajax requests. Its use is not recommended.

    see

    ``

    since

    1.1

    example

    ​ ````Sets the defaults for Ajax requests to the url "/xmlhttp/", disables global handlers and uses POST instead of GET. The following Ajax requests then sends some data without having to set anything else.

    $.ajaxSetup({
    url: "/xmlhttp/",
    global: false,
    type: "POST"
    });
    $.ajax({ data: myData });

    Parameters

    • options: AjaxSettings<any>

      A set of key/value pairs that configure the default Ajax request. All options are optional.

    Returns AjaxSettings<any>

  • Creates an object that handles the actual transmission of Ajax data.

    see

    ``

    since

    1.5

    Parameters

    Returns void

  • camelCase(value: string): string
  • deprecated

    ​ Deprecated since 3.3. Internal. See ``.

    Parameters

    • value: string

    Returns string

  • cleanData(elems: ArrayLike<Element | Window | Document | PlainObject<any>>): void
  • Parameters

    • elems: ArrayLike<Element | Window | Document | PlainObject<any>>

    Returns void

  • contains(container: Element, contained: Element): boolean
  • Check to see if a DOM element is a descendant of another DOM element.

    see

    ``

    since

    1.4

    example

    ​ ````Check if an element is a descendant of another.

    $.contains( document.documentElement, document.body ); // true
    $.contains( document.body, document.documentElement ); // false

    Parameters

    • container: Element

      The DOM element that may contain the other element.

    • contained: Element

      The DOM element that may be contained by (a descendant of) the other element.

    Returns boolean

  • css(elem: Element, name: string): any
  • Parameters

    • elem: Element
    • name: string

    Returns any

  • data<T>(element: Element | Window | Document | PlainObject<any>, key: string, value: T): T
  • data(element: Element | Window | Document | PlainObject<any>, key: string, value: undefined): any
  • data(element: Element | Window | Document | PlainObject<any>, key?: string): any
  • Store arbitrary data associated with the specified element. Returns the value that was set.

    see

    ``

    since

    1.2.3

    example

    ​ ````Get the data named "blah" stored at for an element.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.data demo</title>
    <style>
    div {
    margin: 5px;
    background: yellow;
    }
    button {
    margin: 5px;
    font-size: 14px;
    }
    p {
    margin: 5px;
    color: blue;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>A div</div>
    <button>Get "blah" from the div</button>
    <button>Set "blah" to "hello"</button>
    <button>Set "blah" to 86</button>
    <button>Remove "blah" from the div</button>
    <p>The "blah" value of this div is <span>?</span></p>

    <script>
    $( "button" ).click( function() {
    var value,
    div = $( "div" )[ 0 ];
    switch ( $( "button" ).index( this ) ) {
    case 0 :
    value = jQuery.data( div, "blah" );
    break;
    case 1 :
    jQuery.data( div, "blah", "hello" );
    value = "Stored!";
    break;
    case 2 :
    jQuery.data( div, "blah", 86 );
    value = "Stored!";
    break;
    case 3 :
    jQuery.removeData( div, "blah" );
    value = "Removed!";
    break;
    }
    $( "span" ).text( "" + value );
    });
    </script>

    </body>
    </html>

    Type Parameters

    • T extends null | string | number | boolean | symbol | object

    Parameters

    • element: Element | Window | Document | PlainObject<any>

      The DOM element to associate with the data.

    • key: string

      A string naming the piece of data to set.

    • value: T

      The new data value; this can be any Javascript type except undefined.

    Returns T

  • Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.

    see

    ``

    since

    1.2.3

    Parameters

    • element: Element | Window | Document | PlainObject<any>

      The DOM element to query for the data.

    • key: string

      Name of the data stored.

    • value: undefined

      undefined is not recognized as a data value. Calls such as jQuery.data( el, "name", undefined ) will return the corresponding data for "name", and is therefore the same as jQuery.data( el, "name" )

    Returns any

  • Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.

    see

    ``

    since

    1.2.3

    since

    1.4

    example

    ​ ````Store then retrieve a value from the div element.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.data demo</title>
    <style>
    div {
    color: blue;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>
    The values stored were
    <span></span>
    and
    <span></span>
    </div>

    <script>
    var div = $( "div" )[ 0 ];
    jQuery.data( div, "test", {
    first: 16,
    last: "pizza!"
    });
    $( "span:first" ).text( jQuery.data( div, "test" ).first );
    $( "span:last" ).text( jQuery.data( div, "test" ).last );
    </script>

    </body>
    </html>

    Parameters

    • element: Element | Window | Document | PlainObject<any>

      The DOM element to query for the data.

    • Optional key: string

      Name of the data stored.

    Returns any

  • dequeue(element: Element, queueName?: string): void
  • Execute the next function on the queue for the matched element.

    see

    ``

    since

    1.3

    example

    ​ ````Use jQuery.dequeue() to end a custom queue function which allows the queue to keep going.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.dequeue demo</title>
    <style>
    div {
    margin: 3px;
    width: 50px;
    position: absolute;
    height: 50px;
    left: 10px;
    top: 30px;
    background-color: yellow;
    }
    div.red {
    background-color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <button>Start</button>
    <div></div>

    <script>
    $( "button" ).click(function() {
    $( "div" )
    .animate({ left: '+=200px' }, 2000 )
    .animate({ top: '0px' }, 600 )
    .queue(function() {
    $( this ).toggleClass( "red" );
    $.dequeue( this );
    })
    .animate({ left:'10px', top:'30px' }, 700 );
    });
    </script>

    </body>
    </html>

    Parameters

    • element: Element

      A DOM element from which to remove and execute a queued function.

    • Optional queueName: string

      A string containing the name of the queue. Defaults to fx, the standard effects queue.

    Returns void

  • each<T>(array: ArrayLike<T>, callback: ((this: T, indexInArray: number, value: T) => any)): ArrayLike<T>
  • each<T, K>(obj: T, callback: ((this: T[K], propertyName: K, valueOfProperty: T[K]) => any)): T
  • A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.

    see

    ``

    since

    1.0

    example

    ​ ````Iterates through the array displaying each number as both a word and numeral

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.each demo</title>
    <style>
    div {
    color: blue;
    }
    div#five {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="one"></div>
    <div id="two"></div>
    <div id="three"></div>
    <div id="four"></div>
    <div id="five"></div>

    <script>
    var arr = [ "one", "two", "three", "four", "five" ];
    var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };

    jQuery.each( arr, function( i, val ) {
    $( "#" + val ).text( "Mine is " + val + "." );

    // Will stop running after "three"
    return ( val !== "three" );
    });

    jQuery.each( obj, function( i, val ) {
    $( "#" + i ).append( document.createTextNode( " - " + val ) );
    });
    </script>

    </body>
    </html>
    example

    ​ ````Iterates over items in an array, accessing both the current item and its index.

    $.each( [ "a", "b", "c" ], function( i, l ){
    alert( "Index #" + i + ": " + l );
    });

    Type Parameters

    • T

    Parameters

    • array: ArrayLike<T>

      The array to iterate over.

    • callback: ((this: T, indexInArray: number, value: T) => any)

      The function that will be executed on every object.

        • (this: T, indexInArray: number, value: T): any
        • Parameters

          • this: T
          • indexInArray: number
          • value: T

          Returns any

    Returns ArrayLike<T>

  • A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.

    see

    ``

    since

    1.0

    example

    ​ ````Iterates through the array displaying each number as both a word and numeral

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.each demo</title>
    <style>
    div {
    color: blue;
    }
    div#five {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="one"></div>
    <div id="two"></div>
    <div id="three"></div>
    <div id="four"></div>
    <div id="five"></div>

    <script>
    var arr = [ "one", "two", "three", "four", "five" ];
    var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };

    jQuery.each( arr, function( i, val ) {
    $( "#" + val ).text( "Mine is " + val + "." );

    // Will stop running after "three"
    return ( val !== "three" );
    });

    jQuery.each( obj, function( i, val ) {
    $( "#" + i ).append( document.createTextNode( " - " + val ) );
    });
    </script>

    </body>
    </html>
    example

    ​ ````Iterates over the properties in an object, accessing both the current item and its key.

    $.each({ name: "John", lang: "JS" }, function( k, v ) {
    alert( "Key: " + k + ", Value: " + v );
    });

    Type Parameters

    • T

    • K extends string | number | symbol

    Parameters

    • obj: T

      The object to iterate over.

    • callback: ((this: T[K], propertyName: K, valueOfProperty: T[K]) => any)

      The function that will be executed on every object.

        • (this: T[K], propertyName: K, valueOfProperty: T[K]): any
        • Parameters

          • this: T[K]
          • propertyName: K
          • valueOfProperty: T[K]

          Returns any

    Returns T

  • error(message: string): any
  • Takes a string and throws an exception containing it.

    see

    ``

    since

    1.4.1

    example

    ​ ````Override jQuery.error for display in Firebug.

    jQuery.error = console.error;
    

    Parameters

    • message: string

      The message to send out.

    Returns any

  • escapeSelector(selector: string): string
  • Escapes any character that has a special meaning in a CSS selector.

    see

    ``

    since

    3.0

    example

    ​ ````Escape an ID containing a hash.

    $.escapeSelector( "#target" ); // "\#target"
    
    example

    ​ ````Select all the elements having a class name of .box inside a div.

    $( "div" ).find( "." + $.escapeSelector( ".box" ) );
    

    Parameters

    • selector: string

      A string containing a selector expression to escape.

    Returns string

  • extend<T, U, V, W, X, Y, Z>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z
  • extend<T, U, V, W, X, Y>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y
  • extend<T, U, V, W, X>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X
  • extend<T, U, V, W>(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W
  • extend<T, U, V>(deep: true, target: T, object1: U, object2: V): T & U & V
  • extend<T, U>(deep: true, target: T, object1: U): T & U
  • extend<T>(deep: true, target: T): JQueryStatic & T
  • extend(deep: true, target: any, object1: any, ...objectN: any[]): any
  • extend<T, U, V, W, X, Y, Z>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z
  • extend<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y
  • extend<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X
  • extend<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W
  • extend<T, U, V>(target: T, object1: U, object2: V): T & U & V
  • extend<T, U>(target: T, object1: U): T & U
  • extend<T>(target: T): JQueryStatic & T
  • extend(target: any, object1: any, ...objectN: any[]): any
  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    • object5: Y

      An object containing additional properties to merge in.

    • object6: Z

      An object containing additional properties to merge in.

    Returns T & U & V & W & X & Y & Z

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    • object5: Y

      An object containing additional properties to merge in.

    Returns T & U & V & W & X & Y

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    Returns T & U & V & W & X

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    Returns T & U & V & W

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    Returns T & U & V

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    • object1: U

      An object containing additional properties to merge in.

    Returns T & U

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    Type Parameters

    • T

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: T

      The object to extend. It will receive the new properties.

    Returns JQueryStatic & T

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.1.4

    example

    ​ ````Merge two objects recursively, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1, recursively
    $.extend( true, object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>

    Parameters

    • deep: true

      If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.

    • target: any

      The object to extend. It will receive the new properties.

    • object1: any

      An object containing additional properties to merge in.

    • Rest ...objectN: any[]

      Additional objects containing properties to merge in.

    Returns any

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    • object5: Y

      An object containing additional properties to merge in.

    • object6: Z

      An object containing additional properties to merge in.

    Returns T & U & V & W & X & Y & Z

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    • object5: Y

      An object containing additional properties to merge in.

    Returns T & U & V & W & X & Y

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    • X

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    • object4: X

      An object containing additional properties to merge in.

    Returns T & U & V & W & X

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    • W

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    • object3: W

      An object containing additional properties to merge in.

    Returns T & U & V & W

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    • V

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    • object2: V

      An object containing additional properties to merge in.

    Returns T & U & V

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    • U

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: U

      An object containing additional properties to merge in.

    Returns T & U

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    Type Parameters

    • T

    Parameters

    • target: T

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    Returns JQueryStatic & T

  • Merge the contents of two or more objects together into the first object.

    see

    ``

    since

    1.0

    example

    ​ ````Merge two objects, modifying the first.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var object1 = {
    apple: 0,
    banana: { weight: 52, price: 100 },
    cherry: 97
    };
    var object2 = {
    banana: { price: 200 },
    durian: 100
    };

    // Merge object2 into object1
    $.extend( object1, object2 );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( JSON.stringify( object1 ) );
    </script>

    </body>
    </html>
    example

    ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.extend demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log"></div>

    <script>
    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };

    // Merge defaults and options, without modifying defaults
    var settings = $.extend( {}, defaults, options );

    // Assuming JSON.stringify - not available in IE<8
    $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
    $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
    $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
    </script>

    </body>
    </html>

    Parameters

    • target: any

      An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.

    • object1: any

      An object containing additional properties to merge in.

    • Rest ...objectN: any[]

      Additional objects containing properties to merge in.

    Returns any

  • Load data from the server using a HTTP GET request.

    see

    ``

    since

    1.0

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • data: string | PlainObject<any>

      A plain object or string that is sent to the server with the request.

    • success: null | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      A callback function that is executed if the request succeeds. Required if dataType is provided, but you can use null or `jQuery.noop` as a placeholder.

    • Optional dataType: string

      The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).

    Returns jqXHR<any>

  • Load data from the server using a HTTP GET request.

    see

    ``

    since

    1.0

    example

    ​ ````Get the test.php page contents, which has been returned in json format (<?php echo json_encode( array( "name"=>"John","time"=>"2pm" ) ); ?>), and add it to the page.

    $.get( "test.php", function( data ) {
    $( "body" )
    .append( "Name: " + data.name ) // John
    .append( "Time: " + data.time ); // 2pm
    }, "json" );

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • data_success: null | string | PlainObject<any> | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>
    • dataType: string

      The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).

    Returns jqXHR<any>

  • Load data from the server using a HTTP GET request.

    see

    ``

    since

    1.0

    example

    ​ ````Request the test.php page and send some additional data along (while still ignoring the return results).

    $.get( "test.php", { name: "John", time: "2pm" } );
    
    example

    ​ ````Pass arrays of data to the server (while still ignoring the return results).

    $.get( "test.php", { "choices[]": ["Jon", "Susan"] } );
    
    example

    ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned).

    $.get( "test.php", function( data ) {
    alert( "Data Loaded: " + data );
    });
    example

    ​ ````Alert the results from requesting test.cgi with an additional payload of data (HTML or XML, depending on what was returned).

    $.get( "test.cgi", { name: "John", time: "2pm" } )
    .done(function( data ) {
    alert( "Data Loaded: " + data );
    });

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • success_data: string | PlainObject<any> | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      @param success_data

      • success — A callback function that is executed if the request succeeds. Required if dataType is provided, but you can use null or `jQuery.noop` as a placeholder.
      • data — A plain object or string that is sent to the server with the request.

    Returns jqXHR<any>

  • Load data from the server using a HTTP GET request.

    see

    ``

    since

    1.0

    since

    1.12

    since

    2.2

    example

    ​ ````Request the test.php page, but ignore the return results.

    $.get( "test.php" );
    

    Parameters

    • Optional url_settings: string | UrlAjaxSettings<any>

      @param url_settings

      • url — A string containing the URL to which the request is sent.
      • settings — A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with `$.ajaxSetup()`. See `jQuery.ajax( settings )` for a complete list of all settings. The type option will automatically be set to GET.

    Returns jqXHR<any>

  • Load JSON-encoded data from the server using a GET HTTP request.

    see

    ``

    since

    1.0

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • data: string | PlainObject<any>

      A plain object or string that is sent to the server with the request.

    • success: JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      A callback function that is executed if the request succeeds.

    Returns jqXHR<any>

  • Load JSON-encoded data from the server using a GET HTTP request.

    see

    ``

    since

    1.0

    example

    ​ ````Loads the four most recent pictures of Mount Rainier from the Flickr JSONP API.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.getJSON demo</title>
    <style>
    img {
    height: 100px;
    float: left;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="images"></div>

    <script>
    (function() {
    var flickerAPI = "https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
    $.getJSON( flickerAPI, {
    tags: "mount rainier",
    tagmode: "any",
    format: "json"
    })
    .done(function( data ) {
    $.each( data.items, function( i, item ) {
    $( "<img>" ).attr( "src", item.media.m ).appendTo( "#images" );
    if ( i === 3 ) {
    return false;
    }
    });
    });
    })();
    </script>

    </body>
    </html>
    example

    ​ ````Load the JSON data from test.js and access a name from the returned JSON data.

    $.getJSON( "test.js", function( json ) {
    console.log( "JSON Data: " + json.users[ 3 ].name );
    });
    example

    ​ ````Load the JSON data from test.js, passing along additional data, and access a name from the returned JSON data. If an error occurs, log an error message instead.

    $.getJSON( "test.js", { name: "John", time: "2pm" } )
    .done(function( json ) {
    console.log( "JSON Data: " + json.users[ 3 ].name );
    })
    .fail(function( jqxhr, textStatus, error ) {
    var err = textStatus + ", " + error;
    console.log( "Request Failed: " + err );
    });

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • Optional success_data: string | PlainObject<any> | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      @param url_settings

      • success — A callback function that is executed if the request succeeds.
      • data — A plain object or string that is sent to the server with the request.

    Returns jqXHR<any>

  • Load a JavaScript file from the server using a GET HTTP request, then execute it.

    see

    ``

    since

    1.0

    example

    ​ ````Define a $.cachedScript() method that allows fetching a cached script:

    jQuery.cachedScript = function( url, options ) {

    // Allow user to set any option except for dataType, cache, and url
    options = $.extend( options || {}, {
    dataType: "script",
    cache: true,
    url: url
    });

    // Use $.ajax() since it is more flexible than $.getScript
    // Return the jqXHR object so we can chain callbacks
    return jQuery.ajax( options );
    };

    // Usage
    $.cachedScript( "ajax/test.js" ).done(function( script, textStatus ) {
    console.log( textStatus );
    });
    example

    ​ ````Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.getScript demo</title>
    <style>
    .block {
    background-color: blue;
    width: 150px;
    height: 70px;
    margin: 10px;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <button id="go">&raquo; Run</button>
    <div class="block"></div>

    <script>
    var url = "https://code.jquery.com/color/jquery.color.js";
    $.getScript( url, function() {
    $( "#go" ).click(function() {
    $( ".block" )
    .animate({
    backgroundColor: "rgb(255, 180, 180)"
    }, 1000 )
    .delay( 500 )
    .animate({
    backgroundColor: "olive"
    }, 1000 )
    .delay( 500 )
    .animate({
    backgroundColor: "#00f"
    }, 1000 );
    });
    });
    </script>

    </body>
    </html>

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • Optional success: JQuery.jqXHR.DoneCallback<undefined | string, jqXHR<undefined | string>>

      A callback function that is executed if the request succeeds.

    Returns jqXHR<undefined | string>

  • Load a JavaScript file from the server using a GET HTTP request, then execute it.

    see

    ``

    since

    1.12

    since

    2.2

    Parameters

    Returns jqXHR<undefined | string>

  • globalEval(code: string): void
  • Execute some JavaScript code globally.

    see

    ``

    since

    1.0.4

    example

    ​ ````Execute a script in the global context.

    function test() {
    jQuery.globalEval( "var newVar = true;" )
    }
    test();
    // newVar === true

    Parameters

    • code: string

      The JavaScript code to execute.

    Returns void

  • grep<T>(array: ArrayLike<T>, funсtion: ((elementOfArray: T, indexInArray: number) => boolean), invert?: boolean): T[]
  • Finds the elements of an array which satisfy a filter function. The original array is not affected.

    see

    ``

    since

    1.0

    example

    ​ ````Filters the original array of numbers leaving that are not 5 and have an index greater than 4. Then it removes all 9s.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.grep demo</title>
    <style>
    div {
    color: blue;
    }
    p {
    color: green;
    margin: 0;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div></div>
    <p></p>
    <span></span>

    <script>
    var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
    $( "div" ).text( arr.join( ", " ) );

    arr = jQuery.grep(arr, function( n, i ) {
    return ( n !== 5 && i > 4 );
    });
    $( "p" ).text( arr.join( ", " ) );

    arr = jQuery.grep(arr, function( a ) {
    return a !== 9;
    });

    $( "span" ).text( arr.join( ", " ) );
    </script>

    </body>
    </html>
    example

    ​ ````Filter an array of numbers to include only numbers bigger then zero.

    $.grep( [ 0, 1, 2 ], function( n, i ) {
    return n > 0;
    });
    example

    ​ ````Filter an array of numbers to include numbers that are not bigger than zero.

    $.grep( [ 0, 1, 2 ], function( n, i ) {
    return n > 0;
    }, true );

    Type Parameters

    • T

    Parameters

    • array: ArrayLike<T>

      The array-like object to search through.

    • funсtion: ((elementOfArray: T, indexInArray: number) => boolean)

      The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.

        • (elementOfArray: T, indexInArray: number): boolean
        • Parameters

          • elementOfArray: T
          • indexInArray: number

          Returns boolean

    • Optional invert: boolean

      If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.

    Returns T[]

  • hasData(element: Element | Window | Document | PlainObject<any>): boolean
  • Determine whether an element has any jQuery data associated with it.

    see

    ``

    since

    1.5

    example

    ​ ````Set data on an element and see the results of hasData.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.hasData demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p>Results: </p>

    <script>
    var $p = jQuery( "p" ), p = $p[ 0 ];
    $p.append( jQuery.hasData( p ) + " " ); // false

    $.data( p, "testing", 123 );
    $p.append( jQuery.hasData( p ) + " " ); // true

    $.removeData( p, "testing" );
    $p.append( jQuery.hasData( p ) + " " ); // false

    $p.on( "click", function() {} );
    $p.append( jQuery.hasData( p ) + " " ); // true

    $p.off( "click" );
    $p.append( jQuery.hasData( p ) + " " ); // false
    </script>

    </body>
    </html>

    Parameters

    • element: Element | Window | Document | PlainObject<any>

      A DOM element to be checked for data.

    Returns boolean

  • holdReady(hold: boolean): void
  • Holds or releases the execution of jQuery's ready event.

    see

    ``

    since

    1.6

    deprecated

    ​ Deprecated since 3.2. See ``.

    Cause: The jQuery.holdReady() method has been deprecated due to its detrimental effect on the global performance of the page. This method can prevent all the code on the page from initializing for extended lengths of time.

    Solution: Rewrite the page so that it does not require all jQuery ready handlers to be delayed. This might be accomplished, for example, by late-loading only the code that requires the delay when it is safe to run. Due to the complexity of this method, jQuery Migrate does not attempt to fill the functionality. If the underlying version of jQuery used with jQuery Migrate no longer contains jQuery.holdReady() the code will fail shortly after this warning appears.

    example

    ​ ````Delay the ready event until a custom plugin has loaded.

    $.holdReady( true );
    $.getScript( "myplugin.js", function() {
    $.holdReady( false );
    });

    Parameters

    • hold: boolean

      Indicates whether the ready hold is being requested or released

    Returns void

  • htmlPrefilter(html: string): string
  • Modify and filter HTML strings passed through jQuery manipulation methods.

    see

    ``

    since

    1.12

    since

    2.2

    Parameters

    • html: string

      The HTML string on which to operate.

    Returns string

  • idleTimer(element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(idleTimeoutMillis: number, element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(options: Partial<IdleTimerOptions>, element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(method: "destroy", element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(method: "pause", element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(method: "resume", element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(method: "reset", element?: HTMLElement | Document, id?: string): JQueryStatic
  • idleTimer(method: "getRemainingTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "getElapsedTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "getLastActiveTime", element?: HTMLElement | Document, id?: string): number
  • idleTimer(method: "isIdle", element?: HTMLElement | Document, id?: string): boolean
  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer();

    // binds to document - explicit
    $( document ).idleTimer();

    // bind to different element
    $( "#myTextArea" ).idleTimer();
    });

    Parameters

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer(1000);

    // binds to document - explicit
    $( document ).idleTimer(1000);

    // bind to different element
    $( "#myTextArea" ).idleTimer(1000);
    });

    Parameters

    • idleTimeoutMillis: number

      The timeout period in milliseconds.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • There are two ways to instantiate. Either statically, or on an element. Element bound timers will only watch for events inside of them. You may just want page-level activity, in which case you may set up your timers on document, document.documentElement, and document.body.

    $(function() {
    // binds to document - shorthand
    $.idleTimer({
    timeout:10000,
    idle:true
    });

    // binds to document - explicit
    $( document ).idleTimer({
    timeout:10000,
    idle:true
    });

    // bind to different element
    $( "#myTextArea" ).idleTimer({
    timeout:10000,
    idle:true
    });
    });

    Parameters

    • options: Partial<IdleTimerOptions>

      The options for this idle timer. Any options not specified explicitly are set to their default values.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • Stop the timer, removes data, removes event bindings to come back from this you will need to instantiate again.

    Parameters

    • method: "destroy"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • Saves the remaining time, and stops the timer.

    Parameters

    • method: "pause"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • Starts the timer with remaining time saved when pause was called.

    Parameters

    • method: "resume"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • Restore initial idle state, and restart the timer.

    Parameters

    • method: "reset"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns JQueryStatic

    this JQuery instance for chaining.

  • Get time left until idle. If currently idle, returns 0.

    Parameters

    • method: "getRemainingTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    The time in milliseconds until the user goes idle. If user is already idle, returns 0.

  • Get time elapsed since the user went idle or active.

    • If currently idle, how long the user has been idle.
    • If currently active, how long the user has been active.

    Parameters

    • method: "getElapsedTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    How long the user has been idle or active, in milliseconds.

  • Get time the last active.idleTimer event was fired.

    Parameters

    • method: "getLastActiveTime"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns number

    A timestamp (milliseconds since 1 January 1970 UTC) for when the most recent time the user went from idle to active.

  • Get whether the user is currently idle.

    Parameters

    • method: "isIdle"

      The method to be invoked on this idle timer instance.

    • Optional element: HTMLElement | Document

      Element to watch, defaults to the document.

    • Optional id: string

      Unique ID for this idle timer, to support multiple timers on the same page.

    Returns boolean

    true if the user is currently idle, or false if the user is currently active.

  • inArray<T>(value: T, array: T[], fromIndex?: number): number
  • Search for a specified value within an array and return its index (or -1 if not found).

    see

    ``

    since

    1.2

    example

    ​ ````Report the index of some elements in the array.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.inArray demo</title>
    <style>
    div {
    color: blue;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>"John" found at <span></span></div>
    <div>4 found at <span></span></div>
    <div>"Karl" not found, so <span></span></div>
    <div>"Pete" is in the array, but not at or after index 2, so <span></span></div>

    <script>
    var arr = [ 4, "Pete", 8, "John" ];
    var $spans = $( "span" );
    $spans.eq( 0 ).text( jQuery.inArray( "John", arr ) );
    $spans.eq( 1 ).text( jQuery.inArray( 4, arr ) );
    $spans.eq( 2 ).text( jQuery.inArray( "Karl", arr ) );
    $spans.eq( 3 ).text( jQuery.inArray( "Pete", arr, 2 ) );
    </script>

    </body>
    </html>

    Type Parameters

    • T

    Parameters

    • value: T

      The value to search for.

    • array: T[]

      An array through which to search.

    • Optional fromIndex: number

      The index of the array at which to begin the search. The default is 0, which will search the whole array.

    Returns number

  • isArray(obj: any): obj is any[]
  • Determine whether the argument is an array.

    see

    ``

    since

    1.3

    deprecated

    ​ Deprecated since 3.2. Use `{@link ArrayConstructor.isArray Array.isArray}`.

    example

    ​ ````Finds out if the parameter is an array.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.isArray demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    Is [] an Array? <b></b>

    <script>
    $( "b" ).append( "" + $.isArray([]) );
    </script>

    </body>
    </html>

    Parameters

    • obj: any

      Object to test whether or not it is an array.

    Returns obj is any[]

  • isEmptyObject(obj: any): boolean
  • Check to see if an object is empty (contains no enumerable properties).

    see

    ``

    since

    1.4

    example

    ​ ````Check an object to see if it's empty.

    jQuery.isEmptyObject({}); // true
    jQuery.isEmptyObject({ foo: "bar" }); // false

    Parameters

    • obj: any

      The object that will be checked to see if it's empty.

    Returns boolean

  • isFunction(obj: any): obj is Function
  • Determine if the argument passed is a JavaScript function object.

    see

    ``

    since

    1.2

    deprecated

    ​ Deprecated since 3.3. Use typeof x === "function".

    example

    ​ ````Test a few parameter examples.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.isFunction demo</title>
    <style>
    div {
    color: blue;
    margin: 2px;
    font-size: 14px;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>jQuery.isFunction( objs[ 0 ] ) = <span></span></div>
    <div>jQuery.isFunction( objs[ 1 ] ) = <span></span></div>
    <div>jQuery.isFunction( objs[ 2 ] ) = <span></span></div>
    <div>jQuery.isFunction( objs[ 3 ] ) = <span></span></div>
    <div>jQuery.isFunction( objs[ 4 ] ) = <span></span></div>

    <script>
    function stub() {}
    var objs = [
    function() {},
    { x:15, y:20 },
    null,
    stub,
    "function"
    ];

    jQuery.each( objs, function( i ) {
    var isFunc = jQuery.isFunction( objs[ i ]);
    $( "span" ).eq( i ).text( isFunc );
    });
    </script>

    </body>
    </html>
    example

    ​ ````Finds out if the parameter is a function.

    $.isFunction(function() {});
    

    Parameters

    • obj: any

      Object to test whether or not it is a function.

    Returns obj is Function

  • isNumeric(value: any): boolean
  • Determines whether its argument represents a JavaScript number.

    see

    ``

    since

    1.7

    deprecated

    ​ Deprecated since 3.3. Internal. See ``.

    example

    ​ ````Sample return values of $.isNumeric with various inputs.

    // true (numeric)
    $.isNumeric( "-10" )
    $.isNumeric( "0" )
    $.isNumeric( 0xFF )
    $.isNumeric( "0xFF" )
    $.isNumeric( "8e5" )
    $.isNumeric( "3.1415" )
    $.isNumeric( +10 )
    $.isNumeric( 0144 )

    // false (non-numeric)
    $.isNumeric( "-0x42" )
    $.isNumeric( "7.2acdgs" )
    $.isNumeric( "" )
    $.isNumeric( {} )
    $.isNumeric( NaN )
    $.isNumeric( null )
    $.isNumeric( true )
    $.isNumeric( Infinity )
    $.isNumeric( undefined )

    Parameters

    • value: any

      The value to be tested.

    Returns boolean

  • isPlainObject(obj: any): boolean
  • Check to see if an object is a plain object (created using "{}" or "new Object").

    see

    ``

    since

    1.4

    example

    ​ ````Check an object to see if it's a plain object.

    jQuery.isPlainObject({}) // true
    jQuery.isPlainObject( "test" ) // false

    Parameters

    • obj: any

      The object that will be checked to see if it's a plain object.

    Returns boolean

  • isWindow(obj: any): obj is Window
  • Determine whether the argument is a window.

    see

    ``

    since

    1.4.3

    deprecated

    ​ Deprecated since 3.3. Internal. See ``.

    Cause: This method returns true if its argument is thought to be a window element. It was created for internal use and is not a reliable way of detecting window for public needs.

    Solution: Remove any use of jQuery.isWindow() from code. If it is truly needed it can be replaced with a check for obj != null && obj === obj.window which was the test used inside this method.

    example

    ​ ````Finds out if the parameter is a window.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.isWindow demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    Is 'window' a window? <b></b>

    <script>
    $( "b" ).append( "" + $.isWindow( window ) );
    </script>

    </body>
    </html>

    Parameters

    • obj: any

      Object to test whether or not it is a window.

    Returns obj is Window

  • isXMLDoc(node: Node): boolean
  • Check to see if a DOM node is within an XML document (or is an XML document).

    see

    ``

    since

    1.1.4

    example

    ​ ````Check an object to see if it's in an XML document.

    jQuery.isXMLDoc( document ) // false
    jQuery.isXMLDoc( document.body ) // false

    Parameters

    • node: Node

      The DOM node that will be checked to see if it's in an XML document.

    Returns boolean

  • makeArray<T>(obj: ArrayLike<T>): T[]
  • Convert an array-like object into a true JavaScript array.

    see

    ``

    since

    1.2

    example

    ​ ````Turn a collection of HTMLElements into an Array of them.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.makeArray demo</title>
    <style>
    div {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>First</div>
    <div>Second</div>
    <div>Third</div>
    <div>Fourth</div>

    <script>
    // Returns a NodeList
    var elems = document.getElementsByTagName( "div" );
    // Convert the NodeList to an Array
    var arr = jQuery.makeArray( elems );
    // Use an Array method on list of dom elements
    arr.reverse();
    $( arr ).appendTo( document.body );
    </script>

    </body>
    </html>
    example

    ​ ````Turn a jQuery object into an array

    var obj = $( "li" );
    var arr = $.makeArray( obj );

    Type Parameters

    • T

    Parameters

    • obj: ArrayLike<T>

      Any object to turn into a native Array.

    Returns T[]

  • map<T, TReturn>(array: T[], callback: ((this: Window, elementOfArray: T, indexInArray: number) => undefined | null | TypeOrArray<TReturn>)): TReturn[]
  • map<T, K, TReturn>(obj: T, callback: ((this: Window, propertyOfObject: T[K], key: K) => undefined | null | TypeOrArray<TReturn>)): TReturn[]
  • Translate all items in an array or object to new array of items.

    see

    ``

    since

    1.0

    example

    ​ ````Use $.map() to change the values of an array.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.map demo</title>
    <style>
    div {
    color: blue;
    }
    p {
    color: green;
    margin: 0;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div></div>
    <p></p>
    <span></span>

    <script>
    var arr = [ "a", "b", "c", "d", "e" ];
    $( "div" ).text( arr.join( ", " ) );

    arr = jQuery.map( arr, function( n, i ) {
    return ( n.toUpperCase() + i );
    });
    $( "p" ).text( arr.join( ", " ) );

    arr = jQuery.map( arr, function( a ) {
    return a + a;
    });
    $( "span" ).text( arr.join( ", " ) );
    </script>

    </body>
    </html>
    example

    ​ ````Map the original array to a new one and add 4 to each value.

    $.map( [ 0, 1, 2 ], function( n ) {
    return n + 4;
    });
    example

    ​ ````Map the original array to a new one, adding 1 to each value if it is bigger then zero and removing it if not.

    $.map( [ 0, 1, 2 ], function( n ) {
    return n > 0 ? n + 1 : null;
    });
    example

    ​ ````Map the original array to a new one; each element is added with its original value and the value plus one.

    $.map( [ 0, 1, 2 ], function( n ) {
    return [ n, n + 1 ];
    });
    example

    ​ ````Map the original array to a new one; each element is squared.

    $.map( [ 0, 1, 2, 3 ], function( a ) {
    return a * a;
    });
    example

    ​ ````Map the original array to a new one, removing numbers less than 50 by returning null and subtracting 45 from the rest.

    $.map( [ 0, 1, 52, 97 ], function( a ) {
    return (a > 50 ? a - 45 : null);
    });
    example

    ​ ````Augment the resulting array by returning an array inside the function.

    var array = [ 0, 1, 52, 97 ];
    array = $.map( array, function( a, index ) {
    return [ a - 45, index ];
    });

    Type Parameters

    • T

    • TReturn

    Parameters

    • array: T[]

      The Array to translate.

    • callback: ((this: Window, elementOfArray: T, indexInArray: number) => undefined | null | TypeOrArray<TReturn>)

      The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.

        • (this: Window, elementOfArray: T, indexInArray: number): undefined | null | TypeOrArray<TReturn>
        • Parameters

          • this: Window
          • elementOfArray: T
          • indexInArray: number

          Returns undefined | null | TypeOrArray<TReturn>

    Returns TReturn[]

  • Translate all items in an array or object to new array of items.

    see

    ``

    since

    1.6

    example

    ​ ````Map the original object to a new array and double each value.

    var dimensions = { width: 10, height: 15, length: 20 };
    dimensions = $.map( dimensions, function( value, index ) {
    return value * 2;
    });
    example

    ​ ````Map an object's keys to an array.

    var dimensions = { width: 10, height: 15, length: 20 };
    var keys = $.map( dimensions, function( value, key ) {
    return key;
    });

    Type Parameters

    • T

    • K extends string | number | symbol

    • TReturn

    Parameters

    • obj: T

      The Object to translate.

    • callback: ((this: Window, propertyOfObject: T[K], key: K) => undefined | null | TypeOrArray<TReturn>)

      The function to process each item against. The first argument to the function is the value; the second argument is the key of the object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.

        • (this: Window, propertyOfObject: T[K], key: K): undefined | null | TypeOrArray<TReturn>
        • Parameters

          • this: Window
          • propertyOfObject: T[K]
          • key: K

          Returns undefined | null | TypeOrArray<TReturn>

    Returns TReturn[]

  • merge<T, U>(first: ArrayLike<T>, second: ArrayLike<U>): (T | U)[]
  • Merge the contents of two arrays together into the first array.

    see

    ``

    since

    1.0

    example

    ​ ````Merges two arrays, altering the first argument.

    $.merge( [ 0, 1, 2 ], [ 2, 3, 4 ] )
    
    example

    ​ ````Merges two arrays, altering the first argument.

    $.merge( [ 3, 2, 1 ], [ 4, 3, 2 ] )
    
    example

    ​ ````Merges two arrays, but uses a copy, so the original isn't altered.

    var first = [ "a", "b", "c" ];
    var second = [ "d", "e", "f" ];
    $.merge( $.merge( [], first ), second );

    Type Parameters

    • T

    • U

    Parameters

    • first: ArrayLike<T>

      The first array-like object to merge, the elements of second added.

    • second: ArrayLike<U>

      The second array-like object to merge into the first, unaltered.

    Returns (T | U)[]

  • Relinquish jQuery's control of the $ variable.

    see

    ``

    since

    1.0

    example

    ​ ````Map the original object that was referenced by $ back to $.

    jQuery.noConflict();
    // Do something with jQuery
    jQuery( "div p" ).hide();
    // Do something with another library's $()
    $( "content" ).style.display = "none";
    example

    ​ ````Revert the $ alias and then create and execute a function to provide the $ as a jQuery alias inside the function's scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library.

    jQuery.noConflict();
    (function( $ ) {
    $(function() {
    // More code using $ as alias to jQuery
    });
    })(jQuery);

    // Other code using $ as an alias to the other library
    example

    ​ ````Create a different alias instead of jQuery to use in the rest of the script.

    var j = jQuery.noConflict();

    // Do something with jQuery
    j( "div p" ).hide();

    // Do something with another library's $()
    $( "content" ).style.display = "none";
    example

    ​ ````Completely move jQuery to a new namespace in another object.

    var dom = {};
    dom.query = jQuery.noConflict( true );
    example

    ​ ````Load two versions of jQuery (not recommended). Then, restore jQuery's globally scoped variables to the first loaded jQuery.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.noConflict demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log">
    <h3>Before $.noConflict(true)</h3>
    </div>
    <script src="https://code.jquery.com/jquery-1.6.2.js"></script>

    <script>
    var $log = $( "#log" );

    $log.append( "2nd loaded jQuery version ($): " + $.fn.jquery + "<br>" );

    // Restore globally scoped jQuery variables to the first version loaded
    // (the newer version)

    jq162 = jQuery.noConflict( true );

    $log.append( "<h3>After $.noConflict(true)</h3>" );
    $log.append( "1st loaded jQuery version ($): " + $.fn.jquery + "<br>" );
    $log.append( "2nd loaded jQuery version (jq162): " + jq162.fn.jquery + "<br>" );
    </script>

    </body>
    </html>

    Parameters

    • Optional removeAll: boolean

      A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).

    Returns JQueryStatic

  • nodeName(elem: Node, name: string): boolean
  • deprecated

    ​ Deprecated since 3.2.

    Cause: This public but never-documented method has been deprecated as of jQuery 3.2.0.

    Solution: Replace calls such as jQuery.nodeName( elem, "div" ) with a test such as elem.nodeName.toLowerCase() === "div".

    Parameters

    • elem: Node
    • name: string

    Returns boolean

  • noop(): undefined
  • An empty function.

    see

    ``

    since

    1.4

    Returns undefined

  • now(): number
  • Return a number representing the current time.

    see

    ``

    since

    1.4.3

    deprecated

    ​ Deprecated since 3.3. Use `{@link DateConstructor.now Date.now}`.

    Returns number

  • param(obj: any[] | JQuery<HTMLElement> | PlainObject<any>, traditional?: boolean): string
  • Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.

    see

    ``

    since

    1.2

    since

    1.4

    example

    ​ ````Serialize a key/value object.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.param demo</title>
    <style>
    div {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="results"></div>

    <script>
    var params = { width:1680, height:1050 };
    var str = jQuery.param( params );
    $( "#results" ).text( str );
    </script>

    </body>
    </html>
    example

    ​ ````Serialize a few complex objects

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.param demo</title>
    <style>
    div {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>
    ​​
    <script>
    // <=1.3.2:
    $.param({ a: [ 2, 3, 4 ] }); // "a=2&a=3&a=4"
    // >=1.4:
    $.param({ a: [ 2, 3, 4 ] }); // "a[]=2&a[]=3&a[]=4"

    // <=1.3.2:
    $.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
    // "a=[object+Object]&d=3&d=4&d=[object+Object]"

    // >=1.4:
    $.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
    // "a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5"
    </script>

    </body>
    </html>

    Parameters

    • obj: any[] | JQuery<HTMLElement> | PlainObject<any>

      An array, a plain object, or a jQuery object to serialize.

    • Optional traditional: boolean

      A Boolean indicating whether to perform a traditional "shallow" serialization.

    Returns string

  • parseHTML(data: string, context: undefined | null | Document, keepScripts: boolean): Node[]
  • parseHTML(data: string, context_keepScripts?: null | boolean | Document): Node[]
  • Parses a string into an array of DOM nodes.

    see

    ``

    since

    1.8

    Parameters

    • data: string

      HTML string to be parsed

    • context: undefined | null | Document

      Document element to serve as the context in which the HTML fragment will be created

    • keepScripts: boolean

      A Boolean indicating whether to include scripts passed in the HTML string

    Returns Node[]

  • Parses a string into an array of DOM nodes.

    see

    ``

    since

    1.8

    example

    ​ ````Create an array of DOM nodes using an HTML string and insert it into a div.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.parseHTML demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div id="log">
    <h3>Content:</h3>
    </div>

    <script>
    var $log = $( "#log" ),
    str = "hello, <b>my name is</b> jQuery.",
    html = $.parseHTML( str ),
    nodeNames = [];

    // Append the parsed HTML
    $log.append( html );

    // Gather the parsed HTML's node names
    $.each( html, function( i, el ) {
    nodeNames[ i ] = "<li>" + el.nodeName + "</li>";
    });

    // Insert the node names
    $log.append( "<h3>Node Names:</h3>" );
    $( "<ol></ol>" )
    .append( nodeNames.join( "" ) )
    .appendTo( $log );
    </script>

    </body>
    </html>

    Parameters

    • data: string

      HTML string to be parsed

    • Optional context_keepScripts: null | boolean | Document

      @param context_keepScripts

      • context — Document element to serve as the context in which the HTML fragment will be created
      • keepScripts — A Boolean indicating whether to include scripts passed in the HTML string

    Returns Node[]

  • parseJSON(json: string): any
  • Takes a well-formed JSON string and returns the resulting JavaScript value.

    see

    ``

    since

    1.4.1

    deprecated

    ​ Deprecated since 3.0. Use `{@link JSON.parse }`.

    Cause: The jQuery.parseJSON method in recent jQuery is identical to the native JSON.parse. As of jQuery 3.0 jQuery.parseJSON is deprecated.

    Solution: Replace any use of jQuery.parseJSON with JSON.parse.

    example

    ​ ````Parse a JSON string.

    var obj = jQuery.parseJSON( '{ "name": "John" }' );
    alert( obj.name === "John" );

    Parameters

    • json: string

      The JSON string to parse.

    Returns any

  • parseXML(data: string): XMLDocument
  • Parses a string into an XML document.

    see

    ``

    since

    1.5

    example

    ​ ````Create a jQuery object using an XML string and obtain the value of the title node.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.parseXML demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p id="someElement"></p>
    <p id="anotherElement"></p>

    <script>
    var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
    xmlDoc = $.parseXML( xml ),
    $xml = $( xmlDoc ),
    $title = $xml.find( "title" );

    // Append "RSS Title" to #someElement
    $( "#someElement" ).append( $title.text() );

    // Change the title to "XML Title"
    $title.text( "XML Title" );

    // Append "XML Title" to #anotherElement
    $( "#anotherElement" ).append( $title.text() );
    </script>

    </body>
    </html>

    Parameters

    • data: string

      a well-formed XML string to be parsed

    Returns XMLDocument

  • Load data from the server using a HTTP POST request.

    see

    ``

    since

    1.0

    example

    ​ ````Post to the test.php page and get content which has been returned in json format (<?php echo json_encode(array("name"=>"John","time"=>"2pm")); ?>).

    $.post( "test.php", { func: "getNameAndTime" }, function( data ) {
    console.log( data.name ); // John
    console.log( data.time ); // 2pm
    }, "json");

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • data: string | PlainObject<any>

      A plain object or string that is sent to the server with the request.

    • success: null | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.

    • Optional dataType: string

      The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).

    Returns jqXHR<any>

  • Load data from the server using a HTTP POST request.

    see

    ``

    since

    1.0

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • data_success: null | string | PlainObject<any> | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>
    • dataType: string

      The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).

    Returns jqXHR<any>

  • Load data from the server using a HTTP POST request.

    see

    ``

    since

    1.0

    example

    ​ ````Request the test.php page and send some additional data along (while still ignoring the return results).

    $.post( "test.php", { name: "John", time: "2pm" } );
    
    example

    ​ ````Pass arrays of data to the server (while still ignoring the return results).

    $.post( "test.php", { 'choices[]': [ "Jon", "Susan" ] } );
    
    example

    ​ ````Send form data using Ajax requests

    $.post( "test.php", $( "#testform" ).serialize() );
    
    example

    ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned).

    $.post( "test.php", function( data ) {
    alert( "Data Loaded: " + data );
    });
    example

    ​ ````Alert the results from requesting test.php with an additional payload of data (HTML or XML, depending on what was returned).

    $.post( "test.php", { name: "John", time: "2pm" })
    .done(function( data ) {
    alert( "Data Loaded: " + data );
    });
    example

    ​ ````Post a form using Ajax and put results in a div

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.post demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <form action="/" id="searchForm">
    <input type="text" name="s" placeholder="Search...">
    <input type="submit" value="Search">
    </form>
    <!-- the result of the search will be rendered inside this div -->
    <div id="result"></div>

    <script>
    // Attach a submit handler to the form
    $( "#searchForm" ).submit(function( event ) {

    // Stop form from submitting normally
    event.preventDefault();

    // Get some values from elements on the page:
    var $form = $( this ),
    term = $form.find( "input[name='s']" ).val(),
    url = $form.attr( "action" );

    // Send the data using post
    var posting = $.post( url, { s: term } );

    // Put the results in a div
    posting.done(function( data ) {
    var content = $( data ).find( "#content" );
    $( "#result" ).empty().append( content );
    });
    });
    </script>

    </body>
    </html>

    Parameters

    • url: string

      A string containing the URL to which the request is sent.

    • success_data: string | PlainObject<any> | JQuery.jqXHR.DoneCallback<any, jqXHR<any>>

      @param success_data

      • success — A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
      • data — A plain object or string that is sent to the server with the request.

    Returns jqXHR<any>

  • Load data from the server using a HTTP POST request.

    see

    ``

    since

    1.0

    since

    1.12

    since

    2.2

    example

    ​ ````Request the test.php page, but ignore the return results.

    $.post( "test.php" );
    

    Parameters

    • Optional url_settings: string | UrlAjaxSettings<any>

      @param url_settings

      • url — A string containing the URL to which the request is sent.
      • settings — A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with `$.ajaxSetup()`. See `jQuery.ajax( settings )` for a complete list of all settings. Type will automatically be set to POST.

    Returns jqXHR<any>

  • Prints the currently selected element.

    Parameters

    • selector: string

      CSS selector for the element to print.

    • Optional settings: Partial<PrintSettings>

      Optional settings for printing.

    Returns JQueryStatic

    This jQuery instance for chaining.

  • proxy<TReturn, A, B, C, D, E, F, G>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): (() => TReturn)
  • proxy<TReturn, A, B, C, D, E, F>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): (() => TReturn)
  • proxy<TReturn, A, B, C, D, E>(funсtion: ((a: A, b: B, c: C, d: D, e: E) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): (() => TReturn)
  • proxy<TReturn, A, B, C, D>(funсtion: ((a: A, b: B, c: C, d: D) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): (() => TReturn)
  • proxy<TReturn, A, B, C>(funсtion: ((a: A, b: B, c: C) => TReturn), context: undefined | null, a: A, b: B, c: C): (() => TReturn)
  • proxy<TReturn, A, B>(funсtion: ((a: A, b: B) => TReturn), context: undefined | null, a: A, b: B): (() => TReturn)
  • proxy<TReturn, A>(funсtion: ((a: A) => TReturn), context: undefined | null, a: A): (() => TReturn)
  • proxy<TReturn>(funсtion: (() => TReturn), context: undefined | null): (() => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T) => TReturn)
  • proxy<TReturn, A, B, C, D, T>(funсtion: ((a: A, b: B, c: C, d: D, t: T) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T) => TReturn)
  • proxy<TReturn, A, B, C, T>(funсtion: ((a: A, b: B, c: C, t: T) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T) => TReturn)
  • proxy<TReturn, A, B, T>(funсtion: ((a: A, b: B, t: T) => TReturn), context: undefined | null, a: A, b: B): ((t: T) => TReturn)
  • proxy<TReturn, A, T>(funсtion: ((a: A, t: T) => TReturn), context: undefined | null, a: A): ((t: T) => TReturn)
  • proxy<TReturn, T>(funсtion: ((t: T) => TReturn), context: undefined | null): ((t: T) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, C, T, U>(funсtion: ((a: A, b: B, c: C, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, T, U>(funсtion: ((a: A, b: B, t: T, u: U) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, T, U>(funсtion: ((a: A, t: T, u: U) => TReturn), context: undefined | null, a: A): ((t: T, u: U) => TReturn)
  • proxy<TReturn, T, U>(funсtion: ((t: T, u: U) => TReturn), context: undefined | null): ((t: T, u: U) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U, V>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U, V>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U, V>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U, V>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, C, T, U, V>(funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, T, U, V>(funсtion: ((a: A, b: B, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, T, U, V>(funсtion: ((a: A, t: T, u: U, v: V) => TReturn), context: undefined | null, a: A): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, T, U, V>(funсtion: ((t: T, u: U, v: V) => TReturn), context: undefined | null): ((t: T, u: U, v: V) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U, V, W>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U, V, W>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U, V, W>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, C, T, U, V, W>(funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, T, U, V, W>(funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, T, U, V, W>(funсtion: ((a: A, t: T, u: U, v: V, w: W) => TReturn), context: undefined | null, a: A): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, T, U, V, W>(funсtion: ((t: T, u: U, v: V, w: W) => TReturn), context: undefined | null): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U, V, W, X>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U, V, W, X>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, C, T, U, V, W, X>(funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, T, U, V, W, X>(funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, T, U, V, W, X>(funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null, a: A): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, T, U, V, W, X>(funсtion: ((t: T, u: U, v: V, w: W, x: X) => TReturn), context: undefined | null): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, C, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, T, U, V, W, X, Y>(funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, T, U, V, W, X, Y>(funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null, a: A): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, T, U, V, W, X, Y>(funсtion: ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: undefined | null): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, B, C, D, E, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, B, C, D, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, B, C, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, B, T, U, V, W, X, Y, Z>(funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, A, T, U, V, W, X, Y, Z>(funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null, a: A): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn, T, U, V, W, X, Y, Z>(funсtion: ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: undefined | null): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TReturn>(funсtion: ((...args: any[]) => TReturn), context: undefined | null, ...additionalArguments: any[]): ((...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): (() => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): (() => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): (() => TReturn)
  • proxy<TContext, TReturn, A, B, C, D>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D) => TReturn), context: TContext, a: A, b: B, c: C, d: D): (() => TReturn)
  • proxy<TContext, TReturn, A, B, C>(funсtion: ((this: TContext, a: A, b: B, c: C) => TReturn), context: TContext, a: A, b: B, c: C): (() => TReturn)
  • proxy<TContext, TReturn, A, B>(funсtion: ((this: TContext, a: A, b: B) => TReturn), context: TContext, a: A, b: B): (() => TReturn)
  • proxy<TContext, TReturn, A>(funсtion: ((this: TContext, a: A) => TReturn), context: TContext, a: A): (() => TReturn)
  • proxy<TContext, TReturn>(funсtion: ((this: TContext) => TReturn), context: TContext): (() => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, T>(funсtion: ((this: TContext, a: A, b: B, t: T) => TReturn), context: TContext, a: A, b: B): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, T>(funсtion: ((this: TContext, a: A, t: T) => TReturn), context: TContext, a: A): ((t: T) => TReturn)
  • proxy<TContext, TReturn, T>(funсtion: ((this: TContext, t: T) => TReturn), context: TContext): ((t: T) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, T, U>(funсtion: ((this: TContext, a: A, t: T, u: U) => TReturn), context: TContext, a: A): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, T, U>(funсtion: ((this: TContext, t: T, u: U) => TReturn), context: TContext): ((t: T, u: U) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U, V>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U, V>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U, V>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U, V>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, T, U, V>(funсtion: ((this: TContext, a: A, t: T, u: U, v: V) => TReturn), context: TContext, a: A): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, T, U, V>(funсtion: ((this: TContext, t: T, u: U, v: V) => TReturn), context: TContext): ((t: T, u: U, v: V) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U, V, W>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, T, U, V, W>(funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W) => TReturn), context: TContext, a: A): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, T, U, V, W>(funсtion: ((this: TContext, t: T, u: U, v: V, w: W) => TReturn), context: TContext): ((t: T, u: U, v: V, w: W) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U, V, W, X>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, T, U, V, W, X>(funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext, a: A): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, T, U, V, W, X>(funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn), context: TContext): ((t: T, u: U, v: V, w: W, x: X) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, T, U, V, W, X, Y>(funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext, a: A): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, T, U, V, W, X, Y>(funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn), context: TContext): ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E, f: F): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B, c: C, d: D, e: E): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B, c: C, d: D): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, C, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B, c: C): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, B, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A, b: B): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, A, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext, a: A): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn, T, U, V, W, X, Y, Z>(funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn), context: TContext): ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)
  • proxy<TContext, TReturn>(funсtion: ((this: TContext, ...args: any[]) => TReturn), context: TContext, ...additionalArguments: any[]): ((...args: any[]) => TReturn)
  • proxy<TContext>(context: TContext, name: keyof TContext, ...additionalArguments: any[]): ((...args: any[]) => any)
  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    Parameters

    • funсtion: ((a: A, b: B, c: C) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    Parameters

    • funсtion: ((a: A, b: B) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B): TReturn
        • Parameters

          • a: A
          • b: B

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    Parameters

    • funсtion: ((a: A) => TReturn)

      The function whose context will be changed.

        • (a: A): TReturn
        • Parameters

          • a: A

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    Parameters

    • funсtion: (() => TReturn)

      The function whose context will be changed.

        • (): TReturn
        • Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    Parameters

    • funсtion: ((a: A, b: B, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    Parameters

    • funсtion: ((a: A, t: T) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T): TReturn
        • Parameters

          • a: A
          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    Parameters

    • funсtion: ((t: T) => TReturn)

      The function whose context will be changed.

        • (t: T): TReturn
        • Parameters

          • t: T

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    Parameters

    • funсtion: ((a: A, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    Parameters

    • funсtion: ((t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U): TReturn
        • Parameters

          • t: T
          • u: U

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    • V

    Parameters

    • funсtion: ((a: A, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U, v: V): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    • V

    Parameters

    • funсtion: ((t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U, v: V): TReturn
        • Parameters

          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((a: A, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.9

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    Type Parameters

    • TReturn

    Parameters

    • funсtion: ((...args: any[]) => TReturn)

      The function whose context will be changed.

        • (...args: any[]): TReturn
        • Parameters

          • Rest ...args: any[]

          Returns TReturn

    • context: undefined | null

      The object to which the context (this) of the function should be set.

    • Rest ...additionalArguments: any[]

      Any number of arguments to be passed to the function referenced in the function argument.

    Returns ((...args: any[]) => TReturn)

      • (...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.9

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        Parameters

        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    Parameters

    • funсtion: ((this: TContext, a: A, b: B) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4`

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    Parameters

    • funсtion: ((this: TContext, a: A) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A): TReturn
        • Parameters

          • this: TContext
          • a: A

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4`

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    Parameters

    • funсtion: ((this: TContext) => TReturn)

      The function whose context will be changed.

        • (this: TContext): TReturn
        • Parameters

          • this: TContext

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns (() => TReturn)

      • (): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    Parameters

    • funсtion: ((this: TContext, a: A, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    Parameters

    • funсtion: ((this: TContext, t: T) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T): TReturn
        • Parameters

          • this: TContext
          • t: T

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T) => TReturn)

      • (t: T): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    Parameters

    • funсtion: ((this: TContext, t: T, u: U) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U) => TReturn)

      • (t: T, u: U): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    • V

    Parameters

    • funсtion: ((this: TContext, t: T, u: U, v: V) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U, v: V): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U
          • v: V

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V) => TReturn)

      • (t: T, u: U, v: V): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    • V

    • W

    Parameters

    • funсtion: ((this: TContext, t: T, u: U, v: V, w: W) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U, v: V, w: W): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U
          • v: V
          • w: W

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W) => TReturn)

      • (t: T, u: U, v: V, w: W): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    • V

    • W

    • X

    Parameters

    • funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U, v: V, w: W, x: X): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • g: G
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    • g: G

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • F

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • f: F
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    • f: F

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • E

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • e: E
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    • e: E

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • D

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • d: D
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    • d: D

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • C

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • c: C
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    • c: C

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • B

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • b: B
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    • b: B

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • A

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • a: A
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • a: A

      An argument to be passed to the function referenced in the function argument.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • funсtion: ((this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • t: T
          • u: U
          • v: V
          • w: W
          • x: X
          • y: Y
          • z: Z
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    Returns ((t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn)

      • (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • t: T
        • u: U
        • v: V
        • w: W
        • x: X
        • y: Y
        • z: Z
        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    type: "zombie",
    test: function( event ) {
    // Without proxy, `this` would refer to the event target
    // use event.target to reference that element.
    var element = event.target;
    $( element ).css( "background-color", "red" );

    // With proxy, `this` refers to the me object encapsulating
    // this function.
    $( "#log" ).append( "Hello " + this.type + "<br>" );
    $( "#test" ).off( "click", this.test );
    }
    };

    var you = {
    type: "person",
    test: function( event ) {
    $( "#log" ).append( this.type + " " );
    }
    };

    // Execute you.test() in the context of the `you` object
    // no matter where it is called
    // i.e. the `this` keyword will refer to `you`
    var youClick = $.proxy( you.test, you );

    // attach click handlers to #test
    $( "#test" )
    // this === "zombie"; handler unbound after first click
    .on( "click", $.proxy( me.test, me ) )

    // this === "person"
    .on( "click", youClick )

    // this === "zombie"
    .on( "click", $.proxy( you.test, me ) )

    // this === "<button> element"
    .on( "click", you.test );
    </script>

    </body>
    </html>
    example

    ​ ````Change the context of a function bound to the click handler,

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button type="button" id="test">Test</button></p>
    <div id="log"></div>

    <script>
    var me = {
    // I'm a dog
    type: "dog",

    // Note that event comes *after* one and two
    test: function( one, two, event ) {
    $( "#log" )

    // `one` maps to `you`, the 1st additional
    // argument in the $.proxy function call
    .append( "<h3>Hello " + one.type + ":</h3>" )

    // The `this` keyword refers to `me`
    // (the 2nd, context, argument of $.proxy)
    .append( "I am a " + this.type + ", " )

    // `two` maps to `they`, the 2nd additional
    // argument in the $.proxy function call
    .append( "and they are " + two.type + ".<br>" )

    // The event type is "click"
    .append( "Thanks for " + event.type + "ing." )

    // The clicked element is `event.target`,
    // and its type is "button"
    .append( "the " + event.target.type + "." );
    }
    };

    var you = { type: "cat" };
    var they = { type: "fish" };

    // Set up handler to execute me.test() in the context
    // of `me`, with `you` and `they` as additional arguments
    var proxy = $.proxy( me.test, me, you, they );

    $( "#test" )
    .on( "click", proxy );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    • TReturn

    Parameters

    • funсtion: ((this: TContext, ...args: any[]) => TReturn)

      The function whose context will be changed.

        • (this: TContext, ...args: any[]): TReturn
        • Parameters

          • this: TContext
          • Rest ...args: any[]

          Returns TReturn

    • context: TContext

      The object to which the context (this) of the function should be set.

    • Rest ...additionalArguments: any[]

      Any number of arguments to be passed to the function referenced in the function argument.

    Returns ((...args: any[]) => TReturn)

      • (...args: any[]): TReturn
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        type: "zombie",
        test: function( event ) {
        // Without proxy, `this` would refer to the event target
        // use event.target to reference that element.
        var element = event.target;
        $( element ).css( "background-color", "red" );

        // With proxy, `this` refers to the me object encapsulating
        // this function.
        $( "#log" ).append( "Hello " + this.type + "<br>" );
        $( "#test" ).off( "click", this.test );
        }
        };

        var you = {
        type: "person",
        test: function( event ) {
        $( "#log" ).append( this.type + " " );
        }
        };

        // Execute you.test() in the context of the `you` object
        // no matter where it is called
        // i.e. the `this` keyword will refer to `you`
        var youClick = $.proxy( you.test, you );

        // attach click handlers to #test
        $( "#test" )
        // this === "zombie"; handler unbound after first click
        .on( "click", $.proxy( me.test, me ) )

        // this === "person"
        .on( "click", youClick )

        // this === "zombie"
        .on( "click", $.proxy( you.test, me ) )

        // this === "<button> element"
        .on( "click", you.test );
        </script>

        </body>
        </html>
        example

        ​ ````Change the context of a function bound to the click handler,

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button type="button" id="test">Test</button></p>
        <div id="log"></div>

        <script>
        var me = {
        // I'm a dog
        type: "dog",

        // Note that event comes *after* one and two
        test: function( one, two, event ) {
        $( "#log" )

        // `one` maps to `you`, the 1st additional
        // argument in the $.proxy function call
        .append( "<h3>Hello " + one.type + ":</h3>" )

        // The `this` keyword refers to `me`
        // (the 2nd, context, argument of $.proxy)
        .append( "I am a " + this.type + ", " )

        // `two` maps to `they`, the 2nd additional
        // argument in the $.proxy function call
        .append( "and they are " + two.type + ".<br>" )

        // The event type is "click"
        .append( "Thanks for " + event.type + "ing." )

        // The clicked element is `event.target`,
        // and its type is "button"
        .append( "the " + event.target.type + "." );
        }
        };

        var you = { type: "cat" };
        var they = { type: "fish" };

        // Set up handler to execute me.test() in the context
        // of `me`, with `you` and `they` as additional arguments
        var proxy = $.proxy( me.test, me, you, they );

        $( "#test" )
        .on( "click", proxy );
        </script>

        </body>
        </html>

        Parameters

        • Rest ...args: any[]

        Returns TReturn

  • Takes a function and returns a new one that will always have a particular context.

    see

    ``

    since

    1.4

    since

    1.6

    deprecated

    ​ Deprecated since 3.3. Use `{@link Function#bind }`.

    example

    ​ ````Enforce the context of the function using the "context, function name" signature. Unbind the handler after first click.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.proxy demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <p><button id="test">Test</button></p>
    <p id="log"></p>

    <script>
    var obj = {
    name: "John",
    test: function() {
    $( "#log" ).append( this.name );
    $( "#test" ).off( "click", obj.test );
    }
    };
    $( "#test" ).on( "click", jQuery.proxy( obj, "test" ) );
    </script>

    </body>
    </html>

    Type Parameters

    • TContext

    Parameters

    • context: TContext

      The object to which the context of the function should be set.

    • name: keyof TContext

      The name of the function whose context will be changed (should be a property of the context object).

    • Rest ...additionalArguments: any[]

      Any number of arguments to be passed to the function named in the name argument.

    Returns ((...args: any[]) => any)

      • (...args: any[]): any
      • Takes a function and returns a new one that will always have a particular context.

        see

        ``

        since

        1.4

        since

        1.6

        deprecated

        ​ Deprecated since 3.3. Use `{@link Function#bind }`.

        example

        ​ ````Enforce the context of the function using the "context, function name" signature. Unbind the handler after first click.

        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>jQuery.proxy demo</title>
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        </head>
        <body>

        <p><button id="test">Test</button></p>
        <p id="log"></p>

        <script>
        var obj = {
        name: "John",
        test: function() {
        $( "#log" ).append( this.name );
        $( "#test" ).off( "click", obj.test );
        }
        };
        $( "#test" ).on( "click", jQuery.proxy( obj, "test" ) );
        </script>

        </body>
        </html>

        Parameters

        • Rest ...args: any[]

        Returns any

  • Manipulate the queue of functions to be executed on the matched element.

    see

    ``

    since

    1.3

    example

    ​ ````Show the length of the queue.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.queue demo</title>
    <style>
    div {
    margin: 3px;
    width: 40px;
    height: 40px;
    position: absolute;
    left: 0px;
    top: 30px;
    background: green;
    display: none;
    }
    div.newcolor {
    background: blue;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <button id="show">Show Length of Queue</button>
    <span></span>
    <div></div>

    <script>
    $( "#show" ).click(function() {
    var n = jQuery.queue( $( "div" )[ 0 ], "fx" );
    $( "span" ).text( "Queue length is: " + n.length );
    });

    function runIt() {
    $( "div" )
    .show( "slow" )
    .animate({
    left: "+=200"
    }, 2000 )
    .slideToggle( 1000 )
    .slideToggle( "fast" )
    .animate({
    left: "-=200"
    }, 1500 )
    .hide( "slow" )
    .show( 1200 )
    .slideUp( "normal", runIt );
    }

    runIt();
    </script>

    </body>
    </html>
    example

    ​ ````Queue a custom function.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.queue demo</title>
    <style>
    div {
    margin: 3px;
    width: 40px;
    height: 40px;
    position: absolute;
    left: 0px;
    top: 30px;
    background: green;
    display: none;
    }
    div.newcolor {
    background: blue;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    Click here...
    <div></div>

    <script>
    $( document.body ).click(function() {
    var divs = $( "div" )
    .show( "slow" )
    .animate({ left: "+=200" }, 2000 );
    jQuery.queue( divs[ 0 ], "fx", function() {
    $( this ).addClass( "newcolor" );
    jQuery.dequeue( this );
    });
    divs.animate({ left: "-=200" }, 500 );
    jQuery.queue( divs[ 0 ], "fx", function() {
    $( this ).removeClass( "newcolor" );
    jQuery.dequeue( this );
    });
    divs.slideUp();
    });
    </script>

    </body>
    </html>
    example

    ​ ````Set a queue array to delete the queue.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.queue demo</title>
    <style>
    div {
    margin: 3px;
    width: 40px;
    height: 40px;
    position: absolute;
    left: 0px;
    top: 30px;
    background: green;
    display: none;
    }
    div.newcolor {
    background: blue;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <button id="start">Start</button>
    <button id="stop">Stop</button>
    <div></div>

    <script>
    $( "#start" ).click(function() {
    var divs = $( "div" )
    .show( "slow" )
    .animate({ left: "+=200" }, 5000 );
    jQuery.queue( divs[ 0 ], "fx", function() {
    $( this ).addClass( "newcolor" );
    jQuery.dequeue( this );
    });
    divs.animate({ left: "-=200" }, 1500 );
    jQuery.queue( divs[ 0 ], "fx", function() {
    $( this ).removeClass( "newcolor" );
    jQuery.dequeue( this );
    });
    divs.slideUp();
    });
    $( "#stop" ).click(function() {
    jQuery.queue( $( "div" )[ 0 ], "fx", [] );
    $( "div" ).stop();
    });
    </script>

    </body>
    </html>

    Type Parameters

    • T extends Element

    Parameters

    • element: T

      A DOM element where the array of queued functions is attached.

    • Optional queueName: string

      A string containing the name of the queue. Defaults to fx, the standard effects queue.

    • Optional newQueue: TypeOrArray<QueueFunction<T>>

      The new function to add to the queue. An array of functions to replace the current queue contents.

    Returns JQuery.Queue<T>

  • readyException(error: Error): any
  • Handles errors thrown synchronously in functions wrapped in jQuery().

    see

    ``

    since

    3.1

    example

    ​ ````Pass the received error to console.error.

    jQuery.readyException = function( error ) {
    console.error( error );
    };

    Parameters

    • error: Error

      An error thrown in the function wrapped in jQuery().

    Returns any

  • removeData(element: Element | Window | Document | PlainObject<any>, name?: string): void
  • Remove a previously-stored piece of data.

    see

    ``

    since

    1.2.3

    example

    ​ ````Set a data store for 2 names then remove one of them.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.removeData demo</title>
    <style>
    div {
    margin: 2px;
    color: blue;
    }
    span {
    color: red;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>value1 before creation: <span></span></div>
    <div>value1 after creation: <span></span></div>
    <div>value1 after removal: <span></span></div>
    <div>value2 after removal: <span></span></div>

    <script>
    var div = $( "div" )[ 0 ];
    $( "span:eq(0)" ).text( "" + $( "div" ).data( "test1" ) );
    jQuery.data( div, "test1", "VALUE-1" );
    jQuery.data( div, "test2", "VALUE-2" );
    $( "span:eq(1)" ).text( "" + jQuery.data( div, "test1" ) );
    jQuery.removeData( div, "test1" );
    $( "span:eq(2)" ).text( "" + jQuery.data( div, "test1" ) );
    $( "span:eq(3)" ).text( "" + jQuery.data( div, "test2" ) );
    </script>

    </body>
    </html>

    Parameters

    • element: Element | Window | Document | PlainObject<any>

      A DOM element from which to remove data.

    • Optional name: string

      A string naming the piece of data to remove.

    Returns void

  • Creates an object containing a set of properties ready to be used in the definition of custom animations.

    see

    ``

    since

    1.1

    Type Parameters

    • TElement extends Element = HTMLElement

    Parameters

    • duration: JQuery.Duration

      A string or number determining how long the animation will run.

    • easing: string

      A string indicating which easing function to use for the transition.

    • complete: ((this: TElement) => void)

      A function to call once the animation is complete, called once per matched element.

        • (this: TElement): void
        • Parameters

          • this: TElement

          Returns void

    Returns EffectsOptions<TElement>

  • Creates an object containing a set of properties ready to be used in the definition of custom animations.

    see

    ``

    since

    1.0

    since

    1.1

    Type Parameters

    • TElement extends Element = HTMLElement

    Parameters

    • duration: JQuery.Duration

      A string or number determining how long the animation will run.

    • easing_complete: string | ((this: TElement) => void)

      @param easing_complete

      • easing — A string indicating which easing function to use for the transition.
      • complete — A function to call once the animation is complete, called once per matched element.

    Returns EffectsOptions<TElement>

  • Creates an object containing a set of properties ready to be used in the definition of custom animations.

    see

    ``

    since

    1.0

    since

    1.1

    Type Parameters

    • TElement extends Element = HTMLElement

    Parameters

    • Optional duration_complete_settings: JQuery.Duration | ((this: TElement) => void) | SpeedSettings<TElement>

      @param duration_complete_settings

      • duration — A string or number determining how long the animation will run.
      • complete — A function to call once the animation is complete, called once per matched element.
      • settings

    Returns EffectsOptions<TElement>

  • trim(str: string): string
  • Remove the whitespace from the beginning and end of a string.

    see

    ``

    since

    1.0

    deprecated

    ​ Deprecated since 3.5. Use `{@link String.prototype.trim String.prototype.trim}`.

    example

    ​ ````Remove the white spaces at the start and at the end of the string.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.trim demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <pre id="original"></pre>
    <pre id="trimmed"></pre>

    <script>
    var str = " lots of spaces before and after ";
    $( "#original" ).html( "Original String: '" + str + "'" );
    $( "#trimmed" ).html( "$.trim()'ed: '" + $.trim(str) + "'" );
    </script>

    </body>
    </html>
    example

    ​ ````Remove the white spaces at the start and at the end of the string.

    $.trim("    hello, how are you?    ");
    
    example

    ​ ````Remove the white spaces at the start and at the end of the string.

    $.trim("    hello, how are you?    ");
    

    Parameters

    • str: string

      The string to trim.

    Returns string

  • type(obj: any): "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" | "error" | "date" | "null" | "array" | "regexp"
  • Determine the internal JavaScript Class of an object.

    see

    ``

    since

    1.4.3

    deprecated

    ​ Deprecated since 3.3. See ``.

    example

    ​ ````Find out if the parameter is a RegExp.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.type demo</title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    Is it a RegExp? <b></b>

    <script>
    $( "b" ).append( "" + jQuery.type( /test/ ) );
    </script>

    </body>
    </html>

    Parameters

    • obj: any

      Object to get the internal JavaScript Class of.

    Returns "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" | "error" | "date" | "null" | "array" | "regexp"

  • unique<T>(array: T[]): T[]
  • Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.

    see

    ``

    since

    1.1.3

    deprecated

    ​ Deprecated since 3.0. Use ``.

    Cause: The fact that jQuery.unique sorted its results in DOM order was surprising to many who did not read the documentation carefully. As of jQuery 3.0 this function is being renamed to make it clear.

    Solution: Replace all uses of jQuery.unique with jQuery.uniqueSort which is the same function with a better name.

    example

    ​ ````Removes any duplicate elements from the array of divs.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.unique demo</title>
    <style>
    div {
    color: blue;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>There are 6 divs in this document.</div>
    <div></div>
    <div class="dup"></div>
    <div class="dup"></div>
    <div class="dup"></div>
    <div></div>

    <script>
    // unique() must take a native array
    var divs = $( "div" ).get();

    // Add 3 elements of class dup too (they are divs)
    divs = divs.concat( $( ".dup" ).get() );
    $( "div:eq(1)" ).text( "Pre-unique there are " + divs.length + " elements." );

    divs = jQuery.unique( divs );
    $( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." )
    .css( "color", "red" );
    </script>

    </body>
    </html>

    Type Parameters

    • T extends Element

    Parameters

    • array: T[]

      The Array of DOM elements.

    Returns T[]

  • uniqueSort<T>(array: T[]): T[]
  • Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.

    see

    ``

    since

    1.12

    since

    2.2

    example

    ​ ````Removes any duplicate elements from the array of divs.

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery.uniqueSort demo</title>
    <style>
    div {
    color: blue;
    }
    </style>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    </head>
    <body>

    <div>There are 6 divs in this document.</div>
    <div></div>
    <div class="dup"></div>
    <div class="dup"></div>
    <div class="dup"></div>
    <div></div>

    <script>
    // unique() must take a native array
    var divs = $( "div" ).get();

    // Add 3 elements of class dup too (they are divs)
    divs = divs.concat( $( ".dup" ).get() );
    $( "div:eq(1)" ).text( "Pre-unique there are " + divs.length + " elements." );

    divs = jQuery.uniqueSort( divs );
    $( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." )
    .css( "color", "red" );
    </script>

    </body>
    </html>

    Type Parameters

    • T extends Element

    Parameters

    • array: T[]

      The Array of DOM elements.

    Returns T[]

  • when<TR1, UR1, VR1, TJ1, UJ1, VJ1>(deferredT: TR1 | Promise<TR1, TJ1, any> | Thenable<TR1>, deferredU: UR1 | Promise<UR1, UJ1, any> | Thenable<UR1>, deferredV: VR1 | Promise<VR1, VJ1, any> | Thenable<VR1>): Promise3<TR1, TJ1, never, UR1, UJ1, never, VR1, VJ1, never>
  • when<TR1, UR1, TJ1, UJ1>(deferredT: TR1 | Promise<TR1, TJ1, any> | Thenable<TR1>, deferredU: UR1 | Promise<UR1, UJ1, any> | Thenable<UR1>): Promise2<TR1, TJ1, never, UR1, UJ1, never>
  • when<TR1, TJ1, TR2, TJ2, TR3, TJ3>(deferredT: Promise3<TR1, TJ1, any, TR2, TJ2, any, TR3, TJ3, any> | Promise2<TR1, TJ1, any, TR2, TJ2, any>): Promise3<TR1, TJ1, never, TR2, TJ2, never, TR3, TJ3, never>
  • when<TR1, TJ1>(deferred: TR1 | Promise<TR1, TJ1, any> | Thenable<TR1>): Promise<TR1, TJ1, never>
  • when<TR1, TJ1>(...deferreds: (TR1 | Promise<TR1, TJ1, any> | Thenable<TR1>)[]): Promise<TR1, TJ1, never>
  • when(...deferreds: any[]): Promise<any, any, never>
  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Type Parameters

    • TR1

    • UR1

    • VR1

    • TJ1 = any

    • UJ1 = any

    • VJ1 = any

    Parameters

    Returns Promise3<TR1, TJ1, never, UR1, UJ1, never, VR1, VJ1, never>

  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Type Parameters

    • TR1

    • UR1

    • TJ1 = any

    • UJ1 = any

    Parameters

    Returns Promise2<TR1, TJ1, never, UR1, UJ1, never>

  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Type Parameters

    • TR1

    • TJ1

    • TR2

    • TJ2

    • TR3 = never

    • TJ3 = never

    Parameters

    • deferredT: Promise3<TR1, TJ1, any, TR2, TJ2, any, TR3, TJ3, any> | Promise2<TR1, TJ1, any, TR2, TJ2, any>

    Returns Promise3<TR1, TJ1, never, TR2, TJ2, never, TR3, TJ3, never>

  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Type Parameters

    • TR1

    • TJ1 = any

    Parameters

    Returns Promise<TR1, TJ1, never>

  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Type Parameters

    • TR1 = never

    • TJ1 = never

    Parameters

    • Rest ...deferreds: (TR1 | Promise<TR1, TJ1, any> | Thenable<TR1>)[]

      Zero or more Thenable objects.

    Returns Promise<TR1, TJ1, never>

  • Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.

    see

    ``

    since

    1.5

    example

    ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
    // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
    // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
    var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
    if ( /Whip It/.test( data ) ) {
    alert( "We got what we came for!" );
    }
    });
    example

    ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

    $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
    .then( myFunc, myFailure );

    Parameters

    • Rest ...deferreds: any[]

      Zero or more Thenable objects.

    Returns Promise<any, any, never>

Generated using TypeDoc