I know how to build a library in Javascript, but it is very different in jQuery.
// what I know
var Sambuca;
Sambuca = function(selector) {
var self = {};
self.selector = selector;
self.elements = (typeof selector === 'object') ?
new Array(self.selector) :
document.querySelectorAll(self.selector);
//Our functions will be put here
return self;
};
window.Sambuca = Sambuca;
window.$ === undefined && (window.$ = Sambuca)
- I want to know what is this code in jQuery lib file?
- How do I add my own functions, and how do I get selector and how used in Javascript files?
- What does this code refer to?
// in jQuery
!function (e, t) {
"use strict";
"object" == typeof module && "object" == typeof module.exports ? module.exports = e.document ? t(e, !0) : function (e) {
if (!e.document) throw new Error("jquery module requires a window with a document");
return t(e)
} : t(e)
}("undefined" != typeof window ? window : this, function (C, e) {
"use strict";
});
Answer Nothing seek .nothing find. (thx stackoverflow)
with help ADJenks i found a great help,maybe it will help you
link here : https://gist.github.com/CrocoDillon/9990078