求大神讲解一下下面代码什么意思

(function(global, factory) {

    if (typeof define === 'function' && define.amd) {

        define(function() {

            return factory(global, global.document);

        });

    } else if (typeof module !== 'undefined' && module.exports) {

        module.exports = factory(global, global.document);

    } else {

        global.Shake = factory(global, global.document);

    }

} (typeof window !== 'undefined' ? window : this, function (window, document) {

})

momoyy123
浏览 1461回答 1
1回答

花满楼的小前端a

使你的代码同时兼容AMD/CMD规范,模块化开发时很有用
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript