मैं जावास्क्रिप्ट में नया हूं। क्षमा करें अगर मेरे प्रश्न में कुछ भी गलत है।जावास्क्रिप्ट मॉड्यूल पैटर्न: हमारी लाइब्रेरी में विधियों/प्लगइन को इंजेक्ट/बनाने/बढ़ाने के लिए कैसे?
हमारी लाइब्रेरी में विधियों या प्लगइन को इंजेक्ट/बनाने/बढ़ाने के लिए कैसे? यहाँ "yourlib.js"
var Yourlib = (function() {
// privt. var
var selectedEl = {}
// some privt. funct
function something() {
}
return {
getById : function() {
},
setColor : function() {
}
}
}());
और नीचे है अपने "plugin.js"
/*
How to create the plugin pattern?
Example: I want to create/inject a method/plugin named "setHeight" .
So, i can call it later, like this: Yourlib.getById('an-id').setHeight(value);
How is the pattern?
*/
मुझे लगता है कि इस प्रश्न पर अंतर्गत आता है http://programmers.stackexchange.com/ – sroes