Is there a functionality in framework7 for this like in jquery jQuery.fn.extend()?


#1

is there a functionality in framework7 for this like in jquery jQuery.fn.extend()?

I want to extend the functions in framework7 and this $.fn.extend does not work either…

I want to add this function for instance to add animations to elements with animate.css:

$.fn.extend({
animateCss: function(animationName, callback) {
var animationEnd = (function(el) {
var animations = {
animation: ‘animationend’,
OAnimation: ‘oAnimationEnd’,
MozAnimation: ‘mozAnimationEnd’,
WebkitAnimation: ‘webkitAnimationEnd’,
};

  for (var t in animations) {
    if (el.style[t] !== undefined) {
      return animations[t];
    }
  }
})(document.createElement('div'));

this.addClass('animated ' + animationName).one(animationEnd, function() {
  $(this).removeClass('animated ' + animationName);

  if (typeof callback === 'function') callback();
});

return this;

},
});


#2
var obj={ 
  x:function(i){
    console.log('x is',i)
  } 
};
var OBJ={ 
  y:function(i){
    console.log('y is',i)
  } 
};
var OBJ2={ 
  z:function(i){
    console.log('z is',i)
  } 
};

app.utils.extend(obj,OBJ,OBJ2);

obj.x('ok');
obj.y('ko');
obj.z('ok');

#3

I will try it then let you know if works as I want it