在下面的片段中,我设置
privates.RADIX = 10;
而不是仅仅10
在successinf代码中使用。这是好的做法还是肛门保留?
function peakOut = function (elem, offset, delay, callback) {
var privates = {};
// constants initialization
privates.RADIX = 10;
privates.GRAN_TIME = 15;
privates.GRAN_DIST = 1;
privates.UNITS = 'px';
// privates initialization
privates.el = elem;
privates.start = parseInt($P.getComputedStyle(privates.el).getPropertyValue("top"),
privates.RADIX);
privates.status = 'down';
privates.end = privates.start + offset;
privates.current = privates.start;
privates.id = null;
(function next() {
if ((privates.status === 'down') && (privates.current < privates.end)) {
privates.current += privates.GRAN_DIST;
privates.el.style.top = privates.current + privates.UNITS;
if (!privates.id) {
privates.id = $P.setInterval(next, privates.GRAN_TIME);
}
} else if ((privates.status === 'down') && (privates.current === privates.end)) {
privates.status = 'up';
$R.resetInterval(privates);
$P.setTimeout(next, delay);
} else if ((privates.status === 'up') && (privates.current > privates.start)) {
privates.current -= privates.GRAN_DIST;
privates.el.style.top = privates.current + privates.UNITS;
if (!privates.id) {
privates.id = $P.setInterval(next, privates.GRAN_TIME);
}
} else if ((privates.status === 'up') && (privates.current === privates.start)) {
$R.resetInterval(privates);
callback();
}
}());
};