我知道'class'有时候不适合javascript。
我想修改这个库(dropzonejs)而不改变原始文件。
Dropzone类定义如下,(我包括看似相关的部分)
// Uses AMD or browser globals to create a jQuery plugin.
(Function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
} (function (jQuery) {
var module = { exports: { } }; // Fake component
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
(function() {
var Dropzone, Em, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.protot\
ype; return child; },
__slice = [].slice;
Em = typeof Emitter !== "undefined" && Emitter !== null ? Emitter : require("emitter");
noop = function() {};
Dropzone = (function(_super) {
var extend;
__extends(Dropzone, _super);
})(Em);
}).call(this);
return module.exports;
}));
我如何创建'CustomDropzone'以便我可以覆盖一些Dropzone.prototype.foo函数?