dispose: function() {
var disposer;
while (disposer = this._disposers.shift()) { // expected a conditional expression and instead saw an assignment.
disposer();
}
},
jshint
不满意在disposer
循环中分配了while
。有什么方法可以保持这种逻辑并使它对
jshint
友好? 最佳答案
除非我错过了什么...
dispose: function() {
var disposer = this._disposers.shift();
while (disposer) {
disposer();
disposer = this._disposers.shift();
}
},
您可能还想增强条件:
while (typeof disposer === 'function') {
工作示例:http://jsfiddle.net/DPNYq/