-
-
Save polotek/734781 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Base = { | |
_ops: {}, | |
_privateFnc: function () {}, | |
abstract: function () {}, | |
init: function (ops) { | |
this._ops = ops || {}; | |
// INIT | |
} | |
}; | |
var ThingBaseProps = { | |
abstract: { | |
value: function() { | |
return this._ops; | |
} | |
} | |
}; | |
var ThingBase = Object.create(Base, ThingBaseProps); | |
var Thing = function (ops) { | |
var instance = Object.create(ThingBase); | |
instance.init(ops); | |
return instance; | |
}; | |
var thingA = Thing(), | |
thingB = Thing({foo:'bar'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment