Created
April 28, 2015 08:45
-
-
Save SergSlon/8e25c99aee163d7eb197 to your computer and use it in GitHub Desktop.
Создание модуля JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(root, factory) { | |
| // это для загрузчика модуля АМД | |
| if (typeof define === 'function' && define.amd) { // то есть, если можем дотянуться до define с amd, | |
| define(['underscore', 'jquery', 'exports'], function(_, $, exports) { // то им модуль и создадим | |
| // а вдруг кто-то ждет бэкбон еще и в глобальном объекте | |
| root.Backbone = factory(root, exports, _, $); | |
| }); | |
| // это для Node, где jQuery не нужен | |
| } else if (typeof exports !== 'undefined') { | |
| var _ = require('underscore'); | |
| factory(root, exports, _); | |
| // это для браузера | |
| } else { | |
| root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$)); | |
| } | |
| }(this, function(root, Backbone, _, $) { })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment