map.apps Bundle APIs 4.20.0
    Preparing search index...

    Function bind

    • 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.

      • ...partials: Partials

        a custom argument list.

      Returns (...args: any[]) => any

      a callable function

      use Function.bind instead

      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

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

      use Function.bind instead

    • Type Parameters

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

      Parameters

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

      use Function.bind instead

    • Type Parameters

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

      Parameters

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

      use Function.bind instead

    • Type Parameters

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

      Parameters

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

      use Function.bind instead

    • Type Parameters

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

      Parameters

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

      use Function.bind instead