Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
classapi-page

fluid.copy(tocopy)

Section
Column
width70%

Performs a deep copy (clone) of the object passed in the argument.

Code Block
javascript
javascript
bgColorwhite
borderStylenonejavascript
fluid.copy(tocopy);

File name: Fluid.js

Parameters

Span
classborderless-table

tocopy

(Object) The object to be copied

Return Value

Span
classborderless-table

Object

The copied object

Column
width5%

Column

See Also


Notes

This function recursively copies the contents of tocopy into a new object of the same type.

Example

Code Block
javascript
javascript
var oldModel = fluid.copy(that.model);

In this example, fluid.copy() is being used to preserve a copy of a model. This can be useful for scenarios where some kind of 'revert' or 'undo' might be desirable.