Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
The heart of pd
var Parent = {
constructor: function constructor(magic) {
this.isMagic = magic
return this
},
method: function method() { }
}
var Mixin = {
mixinMethod: function () { }
}
var Child = extend({}, Parent, Mixin, {
constructor: function constructor(magic, count) {
this.count = count
return Parent.constructor.call(this, magic)
},
anotherMethod: function () { }
})
var instance = extend({}, Child).constructor(true, 10)
var slice = Array.prototype.slice;
function extend(object) {
slice.call(arguments, 1).forEach(copyProperties);
return object;
function copyProperties(source) {
Object.getOwnPropertyNames(source).forEach(copyProperty);
function copyProperty(name) {
object[name] = source[name];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.