我们遇到这种有线错误,这种错误不可重复,但却发生了恶意。 它在Jquery中的这一行/函数上抛出错误: 代理:功能(fn,context) {
以下是触发此问题的代码。它用于屏幕旋转,它会在 setTimeout($ .proxy(函数... :
)中抛出错误 _showPanel: function(index) {
// go to first panel, index is out of range
var index = (index > this._panels.length - 1) ? 0 : index,
// calculate next panel index
nextIndex = (index + 1) % this._panels.length,
panel = this._panels[index],
oldPanelElement = this._currentPanelElement;
// set timer when to switch to next panel
this._panelRotationTimeout = **setTimeout($.proxy**(function () {
if (this && this._showPanel) {
this._showPanel(nextIndex);
}
}, this), panel.time);
// hide old panel
if (oldPanelElement) {
oldPanelElement
.hide()
.detach();
}
// show/hide animation
if (panel.animation) {
this._animation.show();
} else {
this._animation.hide();
}
// show new panel
this.element.find('.panelContainer')
.append(panel.element);
panel.element.show();
// update status and button
this._updateDisplay();
// track current panel details
this._currentPanelIndex = index;
this._currentPanelElement = panel.element;
this._currentDeviceStatusIndex = index;
},
答案 0 :(得分:0)
setTimeout
的第一个参数应该是一个函数。在您的示例中,您实际上正在调用$ .proxy,为{。{1}}提供$ .proxy函数的返回值。尝试传递一个匿名函数并在其中执行您的操作:
setTimeout