OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

org.ecmascript.object
Class Function

org.ecmascript.object.Object
   |
   +--org.ecmascript.object.Function

public class Function
extends Object
The native browser JavaScript object used to define code that can be called on demand rather than executing immediately.
Instead of defining a function using the constructor, it is recommended that you use one of the following mechanisms for optimal performance:
And then you can invoke the function by calling functionName(foo, bar);

Note that this object is implemented and supported by the web browser and results of its use may vary.



Field Summary

public Function
caller
The Function object being executed when this Function was executed or undefined if the function is a top-level Function.
public Number
length
The expected number of arguments (not the actual number of arguments).


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Constructor Summary

public
Function(String... argumentNames, String functionBody)
The native browser JavaScript object used to define code that can be called on demand rather than executing immediately.


Method Summary

public Object
apply(Object callingObject, Array argumentArray)
Allows you to apply a method of another object in the context of a different object (the calling object); useful for implementing inheritance.
public Object
call(Object callingObject, Object... arguments)
Allows you to apply a method of another object in the context of a different object (the calling object); useful for implementing inheritance.
public String
toSource()
Generates a String representation of the function's source code.
public String
toString()
Generates a String representation of the function's source code.


Field Detail


caller

public Function caller

The Function object being executed when this Function was executed or undefined if the function is a top-level Function.
See also:
Arguments.caller

length

public Number length

The expected number of arguments (not the actual number of arguments).
See also:
Arguments.length

Constructor Detail


Function

public Function(String... argumentNames,
                String functionBody)

The native browser JavaScript object used to define code that can be called on demand rather than executing immediately.
Instead of defining a function using the constructor, it is recommended that you use one of the following mechanisms for optimal performance:
  • function functionName(functionArgumentName1, functionArgumentName2)
    {
      // function body
    }
  • var functionName = function(functionArgumentName1, functionArgumentName2)
    {
      // function body
    };
And then you can invoke the function by calling functionName(foo, bar);

Note that this object is implemented and supported by the web browser and results of its use may vary.

Parameters:
argumentNames  -  zero or more argument names for the function
functionBody  -  the body of the function

Method Detail


apply

public Object apply(Object callingObject,
                    Array argumentArray)

Allows you to apply a method of another object in the context of a different object (the calling object); useful for implementing inheritance. This is similar to call(), except for the type of arguments that is supports. You can use an arguments array instead of a named set of parameters which allows you to share all of the unspecified arguments of the called object without knowing what they are.

Parameters:
callingObject  -  the parameter for the calling object (e.g. this)
argumentArray  -  an argument array for the object (e.g. arguments)
Return:
Object - the result of the method application
See also:
call(Object, Object...)

call

public Object call(Object callingObject,
                   Object... arguments)

Allows you to apply a method of another object in the context of a different object (the calling object); useful for implementing inheritance. This is similar to apply(), except for the type of arguments that is supports. You must specify each argument individually when using call().

Parameters:
callingObject  -  the parameter for the calling object (e.g. this)
arguments  -  each argument for the object (e.g. each item in the arguments array)
Return:
Object - the result of the method call
See also:
apply(Object, Array)

toSource

public String toSource()

Generates a String representation of the function's source code.

Return:
String - a String representation of the function's source code; a generic placeholder of "[native code]" may exist in this code for source code that is not available

toString

public String toString()

Generates a String representation of the function's source code.

Return:
String - a String representation of the function's source code; a generic placeholder of "[native code]" may exist in this code for source code that is not available

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2011.04.27 02:28 UTC
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.