如何在函数数组UI.switcher.animations中添加一个新函数,以便在运行时使用它?
Animations = {
'none': function() {
var d = $.Deferred();
d.resolve();
return d.promise();
},
'fade': function(current, next) {
return coreAnimation.apply(this, ['@-animation-fade', current, next]);
}
};
UI.switcher.animations = Animations;
上面的代码是yoothemes uikit的切换器组件的Javascript的一部分。这是github中完整代码的链接。 https://github.com/uikit/uikit/blob/acd4da2407070e6092459a1eab08f7020de72548/src/js/core/switcher.js