- prototype?
, - , , , . prototype:
, . , (, ). , prototype , - , , .
, ( ):
SomeObj.prototype = {
method1: function () {},
method2: function () {}
}
, , . , , . , , - .
var SomeObj = function (flag) {
delete SomeObj.reset;
SomeObj.prototype.reset = function () { }
new
{}, new. new (function). - , - , .
. , - , , , . , - require.js, "", require, define, , , .
prototype
:
var attachTo = {};
;(function (attachTo, window, document, undefined) {
Plugin = function () { };
Plugin.prototype = { };
attachTo.plugin = Plugin;
})(attachTo, window, document);
var plugin = new (attachTo.plugin);
http://jsfiddle.net/ExplosionPIlls/HPjV7/1/