Flusspferd API and module docs

namespace Function

Description

Function objects. Class constructors are also functions.

Methods

Class methods

  • bind #

    Function.bind(function, obj) ⇒ Function
    Function#bind(obj) ⇒ Function
    • obj (?) : value to bind to this.

    Bind a function with the given invocant. Returns a closure function that always call the original function with the requested this value.

    function myfunc() { ... }
    var bound = myfunc.bind(myobj)
    bound() // calls myfunc with myobj as "this"

    This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.