Examplifier: Turn bland source code into interactive demos
raynos.github.com6 pointsby Raynos0 comments
[1]: https://github.com/Raynos/html-delegator/blob/master/README.md
[2]: https://github.com/Raynos/mercury Object.getPrototypeOf(this).method
Always have one value and only one value, calling it more then once leads to infinite recursion. Object.getPrototypeOf(Child).constructor.apply(this, arguments);
Works, but is even more verbose. However if you use Object.getPrototypeOf on this you fail the recursive problem in nest super calls. Read the stackoverflow euestion var Animal = {
constructor: function () {
this.legs = legs;
},
speed: function () {
return this.legs * 10;
}
};
var Dog = pd.make(Animal, {
constructor: function (name) {
Animal.constructor.call(this, 4);
this.name = name;
},
speed: function () {
return Animal.speed.call(this) * 2;
}
}); var Cat = Object.make(Animal, {
constructor: function() {
Animal.constructor.apply(this, arguments);
...
},
walk: function() {
Animal.walk.apply(this, arguments);
...
}
});
Now compare:
Once you've loaded it and mutated it for testing purposes or for copying from ENV vars into the config, you can then freeze it before passing it down to all your app level code.
Having this wrapper object that can be frozen and has a `get()` method to read JSON like data make it effectively not mutable.