我有一个非常奇怪的行为,我不明白为什么会发生
在脚本运行结束时,末尾的console.log会打印一次,然后针对每个发生的事件再次打印,并且tempOutput数组会出现3次,每次都有不同的值。
var tempOutput = []
if (limited) {
var selectseries = mvc.Components.getInstance('selectseries');
selectseries.on("change", function(event) {
let vfx = setInterval(
function() {
dropSelect.classList.add('pulse-on');
setTimeout(
function() {
dropSelect.classList.remove('pulse-on')
}, 1200
)
}, 2400);
defaultTokenModel.on("change:" + dropDownTyp.tokenName, function(e) {
if (vfx) {
clearInterval(vfx);
document.querySelector('#drop_arrow').style.background = ''
}
});
} else {
dropSelect.setAttribute('value', '<Select ' + label + '>')
dropSelect.classList.add('disable')
}
})
}
console.log("how much?")
console.log(tempOutput)
我希望看到阵列打印一次,然后一次打印“多少?”