Created
July 15, 2011 05:30
-
-
Save leobalter/1084136 to your computer and use it in GitHub Desktop.
MyObj creation like jQuery is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window, undefined) { | |
var MyObj = (function () { | |
var MyObj = function () { | |
return new MyObj.fn.init(); | |
}; | |
MyObj.fn = MyObj.prototype = { | |
init : function () { | |
return this; | |
}, | |
count : function () { | |
for(var i in this) { | |
if (this.hasOwnProperty(i)) { | |
console.log("Element "+i+" is "+this[i]); | |
} | |
} | |
} | |
}; | |
MyObj.fn.init.prototype = MyObj.fn; | |
MyObj.test = 'yay'; | |
return MyObj; | |
}()); | |
window.MyObj = MyObj; | |
}(window)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment