• Jump To … +
    Array.litcoffee Boolean.litcoffee Function.litcoffee Number.litcoffee Object.litcoffee String.litcoffee _register.js _to_map_and_write_Tests.litcoffee assert_Array.litcoffee assert_Boolean.litcoffee assert_Function.litcoffee assert_Number.litcoffee assert_Object.litcoffee assert_String.litcoffee console.litcoffee fs.litcoffee globals.litcoffee http.litcoffee index.md path.litcoffee process.litcoffee Array.test.coffee Boolean.test.coffee Function.test.coffee Number.test.coffee Object.test.coffee String.test.coffee Array.test.coffee Boolean.test.coffee Function.test.coffee Number.test.coffee Object.test.coffee String.test.coffee console.test.coffee fs.test.coffee globals.test.coffee http.test.coffee path.test.coffee process.test.coffee
  • Function.litcoffee

  • ¶

    Adds helper methods to the native javascript Function class

    Function::ctor params…

    Creates a new object from the parent function

    Function::ctor   = (params...)->
        new @(params...)
  • ¶

    Function::invoke params…

    Invokes the function with the provided params. Note that the this object is set to null

    Function::invoke = (params...)->
        @.apply(null, params)
  • ¶

    Function::invoke_In value

    Invokes the function in value miliseconds

    Function::invoke_In = (value)->
        setTimeout @, value
  • ¶

    Function::new params …

    Function::new    = Function::ctor
  • ¶

    Function::sourceCode

    Returns the source code of the current function. This done using an easy trick which is usually not that obvious. All we have to do is to call the .toString() method of the function (another option is to append the function to a string @ + "")

    Function::sourceCode = ()->
        @.toString()
  • ¶

  • ¶

    back to index