日期:2014-05-16 浏览次数:20330 次
(function(){ var Effects = window.Effects = function(){ var transTotal = 10; this.transition = function (maskID, maskTime){ if (maskID <= transTotal) { var maskFunName = "mask" + maskID; eval(maskFunName)(maskTime); //这里因为使用了eval方法所以造成无法通过google closure compiler编译,如何才能使编译正常通过? } else { mask1(maskTime); } } function mask1(maskTime) { alert("mask1: " + maskTime); } function mask2(maskTime) { alert("mask2: " + maskTime); } function mask3(maskTime) { alert("mask3: " + maskTime); } /* . . . ...下面还有很多mask函数. */ }; })(); var masker = new Effects(); masker.transition(3, 2); masker.transition(30, 8);