An Utility Class allowing the instances of a class implementing it to be cloned.
if(console && console.log) alert = console.log;
var Example = new Class({
Implements: [Clonable],
text: 'This is the original object',
log: function()
{
alert(this.text);
},
cloneInitialize: function() // see Notes
{
this.text = 'This is a clone';
}
});
var object = new Example();
var clone = object.clone();
alert(object == clone); // false
object.log(); // 'This is the original object'
clone.log(); // 'This is a clone'
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus