Guest User

Untitled

a guest
May 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. var Base = {
  2. _ops: {},
  3. _privateFnc: function () {},
  4. abstract: function () {},
  5. init: function (ops) {
  6. this._ops = ops || {};
  7. // INIT
  8. }
  9. };
  10.  
  11. var Thing = (function () {
  12. var ThingBase = Object.create(Base);
  13.  
  14. ThingBase = {
  15. abstract: function() {
  16. return this._ops;
  17. }
  18. };
  19.  
  20. return function (ops) {
  21. var instance = Object.create(ThingBase);
  22. instance.init(ops);
  23. return instance;
  24. };
  25. })();
  26.  
  27. var thingA = Thing(),
  28. thingB = Thing({foo:'bar'});
Add Comment
Please, Sign In to add comment