I looked at the following template while viewing the SlickGrid source code:
(function ($) {
var SlickEditor = {
TextCellEditor: function (args) {
...
},
LongTextCellEditor: function (args) {
...
}
};
$.extend(window, SlickEditor);
})(jQuery);
If I understand this correctly, it uses a direct call to define various function objects, and then combine them into a global namespace.
So, I could just define my functions globally, like this, and it will have the same effect, right?
function TextCellEditor (args) {
...
}
function LongTextCellEditor (args) {
...
}
The only difference I see is that in the first version I can use shorthand $to refer to an object jQuery. In addition, the result will be the same in both cases.
I would like to know if I missed something. Maybe there is another good reason for this?
. : , , . , . , - .
, , . , $ TextCellEditor(). $ TextCellEditor(), .
.