Class: SC.Copyable

Implements some standard methods for copying an object. Add this mixin to any object you create that can create a copy of itself. This mixin is added automatically to the built-in array.

You should generally implement the copy() method to return a copy of the receiver.

Note that frozenCopy() will only work if you also implement SC.Freezable.

Defined in: copyable.js

Since:
SproutCore 1.0

Field Summary

Instance Methods

Field Detail

isCopyable Boolean
Walk like a duck. Indicates that the object can be copied.

Instance Method Detail

copy(deep)

Override to return a copy of the receiver. Default implementation raises an exception.

Parameters:
deep
{Boolean} if true, a deep copy of the object should be made
Returns:
Object
copy of receiver
frozenCopy()

If the object implements SC.Freezable, then this will return a new copy if the object is not frozen and the receiver if the object is frozen.

Raises an exception if you try to call this method on a object that does not support freezing.

You should use this method whenever you want a copy of a freezable object since a freezable object can simply return itself without actually consuming more memory.

Returns:
Object
copy of receiver or receiver
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)