• Creates a new function, which has this bound to scope. Only difference to Function.bind is, that it can bind a string value so the real executed function may change in the scope. Hint: It is semantically equal to the behavior of dojo/_base/lang#hitch.

    Type Parameters

    • Scope
    • MethodName extends string
    • Partials extends any[]

    Parameters

    • scope: Scope

      the this object

    • name: MethodName

      the function or the name of a function.

    • Rest ...partials: Partials

      a custom argument list.

    Returns ((...args) => any)

    a callable function

      • (...args): any
      • Parameters

        • Rest ...args: any[]

        Returns any

    Deprecated

    use Function.bind instead

    Example

    let x = {
    count : 1,
    inc(i){
    return this.count+=i;
    }
    };
    // use "name" binding
    let inc = bind(x, "inc", 5);

    assert.equal(inc(), 5);
    assert.equal(inc(), 10);
  • Type Parameters

    • Scope
    • A extends any[]
    • R

    Parameters

    • scope: Scope
    • fn: ((this, ...a) => R)
        • (this, ...a): R
        • Parameters

          Returns R

    Returns ((...a) => R)

      • (...a): R
      • Parameters

        • Rest ...a: A

        Returns R

    Deprecated

    use Function.bind instead

  • Type Parameters

    • Scope
    • A0
    • A extends any[]
    • R

    Parameters

    • scope: Scope
    • fn: ((this, a0, ...a) => R)
        • (this, a0, ...a): R
        • Parameters

          Returns R

    • a0: A0

    Returns ((...a) => R)

      • (...a): R
      • Parameters

        • Rest ...a: A

        Returns R

    Deprecated

    use Function.bind instead

  • Type Parameters

    • Scope
    • A0
    • A1
    • A extends any[]
    • R

    Parameters

    • scope: Scope
    • fn: ((this, a0, a1, ...a) => R)
        • (this, a0, a1, ...a): R
        • Parameters

          Returns R

    • a0: A0
    • a1: A1

    Returns ((...a) => R)

      • (...a): R
      • Parameters

        • Rest ...a: A

        Returns R

    Deprecated

    use Function.bind instead

  • Type Parameters

    • Scope
    • A0
    • A1
    • A2
    • A extends any[]
    • R

    Parameters

    • scope: Scope
    • fn: ((this, a0, a1, a2, ...a) => R)
        • (this, a0, a1, a2, ...a): R
        • Parameters

          Returns R

    • a0: A0
    • a1: A1
    • a2: A2

    Returns ((...a) => R)

      • (...a): R
      • Parameters

        • Rest ...a: A

        Returns R

    Deprecated

    use Function.bind instead

  • Type Parameters

    • Scope
    • A0
    • A1
    • A2
    • A3
    • A extends any[]
    • R

    Parameters

    • scope: Scope
    • fn: ((this, a0, a1, a2, a3, ...a) => R)
        • (this, a0, a1, a2, a3, ...a): R
        • Parameters

          Returns R

    • a0: A0
    • a1: A1
    • a2: A2
    • a3: A3

    Returns ((...a) => R)

      • (...a): R
      • Parameters

        • Rest ...a: A

        Returns R

    Deprecated

    use Function.bind instead

Generated using TypeDoc