在 javascript 原型中,方法是否可以访问其他方法的属性,例如:如何使 open 方法可以使用选项?
function Plugin(element, options) {
Modal = this;
Modal.options = $.extend({}, defaults, options);
Modal._defaults = defaults;
Modal.init(Modal.element, Modal.options);
}
Plugin.prototype = {
init: function(element, options) {
console.log(options);
},
open: function() {
//Does this function have access to options?
//how to modify so that 'open' function has access to options
}
}