javascriptモジュールの簡単な書き方
1603 ワード
書き方1:
(function (wd, doc) {
var mw = {};
mw.noConflict = noConflict;
var _$ = wd.$;
wd.$ = mw;
function noConflict() {
wd.$ = _$;
wd.mw = mw;
return mw;
}
}
)(window, document);
書き方2:Xrm = function () {};
Xrm.Common = function () {
var guidsAreEqual = function (guid1, guid2) {
var isEqual;
if (guid1 === null || guid2 === null || guid1 === undefined || guid2 === undefined) {
isEqual = false;
}
else {
isEqual = guid1.replace(/[{}]/g, "").toLowerCase() === guid2.replace(/[{}]/g, "").toLowerCase();
}
return isEqual;
};
return {
GuidsAreEqual: guidsAreEqual
};
}();
Xrm.Rest = function () {}();
Xrm.Soap = function () {}();
Xrm.Extension = function () {}();