The following methods are added to the YUI instance

Properties

Events

Module: oop

Methods

aggregate

aggregate
(
  • r
  • s
  • ov
  • wl
)
Object

Applies object properties from the supplier to the receiver. If the target has the property, and the property is an object, the target object will be augmented with the supplier's value. If the property is an array, the suppliers value will be appended to the target.

Parameters:

nametypeflagdescription
r Function

the object to receive the augmentation.

s Function

the object that supplies the properties to augment.

ov Boolean

if true, properties already on the receiver will be overwritten if found on the supplier.

wl String

a whitelist. If supplied, only properties in this list will be applied to the receiver.

Returns:

[Object]

the extended object.

augment

augment
(
  • r
  • s
  • ov
  • wl
  • args
)
Object

Applies prototype properties from the supplier to the receiver. The receiver can be a constructor or an instance.

Parameters:

nametypeflagdescription
r Function

the object to receive the augmentation.

s Function

the object that supplies the properties to augment.

ov Boolean

if true, properties already on the receiver will be overwritten if found on the supplier.

wl String

a whitelist. If supplied, only properties in this list will be applied to the receiver.

args Array | Any

arg or arguments to apply to the supplier constructor when initializing.

Returns:

[Object]

the augmented object.

bind

bind
(
  • f
  • c
  • args
)
Function

Returns a function that will execute the supplied function in the supplied object's context, optionally adding any additional supplied parameters to the beginning of the arguments collection the supplied to the function.

Parameters:

nametypeflagdescription
f Function | String

the function to bind, or a function name to execute on the context object.

c Object

the execution context.

args Any multiple

0..n arguments to include before the arguments the function is executed with.

Returns:

[Function]

the wrapped function.

clone

clone
(
  • o
  • safe
  • f
  • c
  • owner
  • cloned
)
Array | Object

Deep obj/array copy. Function clones are actually wrappers around the original function. Array-like objects are treated as arrays. Primitives are returned untouched. Optionally, a function can be provided to handle other data types, filter keys, validate values, etc.

Parameters:

nametypeflagdescription
o Object

what to clone.

safe Boolean

if true, objects will not have prototype items from the source. If false, they will. In this case, the original is initially protected, but the clone is not completely immune from changes to the source object prototype. Also, cloned prototype items that are deleted from the clone will result in the value of the source prototype being exposed. If operating on a non-safe clone, items should be nulled out rather than deleted.

f Function

optional function to apply to each item in a collection; it will be executed prior to applying the value to the new object. Return false to prevent the copy.

c Object

optional execution context for f.

owner Object

Owner object passed when clone is iterating an object. Used to set up context for cloned functions.

cloned Object

hash of previously cloned objects to avoid multiple clones.

Returns:

[Array | Object]

the cloned object.

each

each
(
  • o
  • f
  • c
  • proto
)
YUI

Executes the supplied function for each item in a collection. Supports arrays, objects, and Y.NodeLists

Parameters:

nametypeflagdescription
o Object

the object to iterate.

f Function

the function to execute. This function receives the value, key, and object as parameters.

c Object

the execution context for the function.

proto Boolean

if true, prototype properties are iterated on objects.

Returns:

[YUI]

the YUI instance.

extend

extend
(
  • r
  • s
  • px
  • sx
)
Object

Utility to set up the prototype, constructor and superclass properties to support an inheritance strategy that can chain constructors and methods. Static members will not be inherited.

Parameters:

nametypeflagdescription
r Function

the object to modify.

s Function

the object to inherit.

px Object

prototype properties to add/override.

sx Object

static properties to add/override.

Returns:

[Object]

the extended object.

rbind

rbind
(
  • f
  • c
  • args
)
Function

Returns a function that will execute the supplied function in the supplied object's context, optionally adding any additional supplied parameters to the end of the arguments the function is executed with.

Parameters:

nametypeflagdescription
f Function | String

the function to bind, or a function name to execute on the context object.

c Object

the execution context.

args Any multiple

0..n arguments to append to the end of arguments collection supplied to the function.

Returns:

[Function]

the wrapped function.

some

some
(
  • o
  • f
  • c
  • proto
)
Boolean

Executes the supplied function for each item in a collection. The operation stops if the function returns true. Supports arrays, objects, and Y.NodeLists.

Parameters:

nametypeflagdescription
o Object

the object to iterate.

f Function

the function to execute. This function receives the value, key, and object as parameters.

c Object

the execution context for the function.

proto Boolean

if true, prototype properties are iterated on objects.

Returns:

[Boolean]

true if the function ever returns true, false otherwise.

Top