Skip to content

Instantly share code, notes, and snippets.

@jasonkarns
Created March 5, 2010 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonkarns/322377 to your computer and use it in GitHub Desktop.
Save jasonkarns/322377 to your computer and use it in GitHub Desktop.
jQuery mutator for MooTools
Class.Mutators.jQuery= function(jquery){
return jquery;
};
Class.Mutators.initialize = function(initialize){
return function(){
//console.log("add ", this.jQuery.method, " to jQuery");
jQuery.fn[this.jQuery.method] = function(){};
$splat(this.jQuery.helpers).each(function(name){
//console.log("add ", name, " as ", this[name], " to jQuery.", this.jQuery.method);
jQuery.fn[this.jQuery.method][name] = this[name];
}, this);
return initialize.apply(this, arguments);
};
};
var MyClass = new Class({
Implements: [Options,Events],
options: {},
jQuery: {
method: 'jqfun',
helpers: ['one', 'two']
},
initialize: function(){},
one: function(){},
two: function(){},
three: function(){}
});
var mine = new MyClass();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment