src/n13.js
/**
     * This is asynchronous files loader. It takes a class and loads it and all it's dependencies. After that, it create
     * full class function and we can use new operator for this.
     * @param {String} cl Name of the class. e.g.: 'App.Class'
     * @private
     */
This is asynchronous files loader. It takes a class and loads it and all it's dependencies. After that, it create
full class function and we can use new operator for this.
@param {String} cl Name of the class.
This is asynchronous files loader . It takes a class and loads it and all it ' s dependencies . After that it create full class function and we can use new operator for this . @param { String } cl Name of the class .
function _loadClass(cl) {
        var baseUrl = _config.baseUrl;
        function insertScript(cl) {
            if (_isN13Class(cl) && !_loadClasses[cl]) {
                var node = document.createElement('script');
                var head = document.getElementsByTagName('head')[0] || document.firstChild;
                node.type    = 'text/javascript';
                node.charset = 'utf-8';
                node.async   = true;
                node.src     = baseUrl + _config.appRoot[1] + '/' + _classToFile(cl) + '.js' + (_config.cache ? '?u=' + (new Date()).getTime() : '');
                head.appendChild(node);
                _filesLoading++;
                _loadClasses[cl] = (new Date()).getTime();
            }
        }
        function loadClasses(classes) {
            var i;
            var len;
            var cl;
            if (classes) {
                for (i = 0, len = classes.length; i < len; i++) {
                    cl = ns(classes[i], false);
                    if (isFunction(cl)) {
                        loadClasses(ns(classes[i], false).prototype.requires);
                    } else {
                        insertScript(classes[i]);
                    }
                }
            }
        }
        loadClasses(isArray(cl) ? cl : [cl]);
         All scripts have already loaded
        if (!_filesLoading) {
            _onLoadEnd();
        }
    }
function _loadClass ( cl ) { var baseUrl = _config . baseUrl ; function insertScript ( cl ) { if ( _isN13Class ( cl ) && ! _loadClasses [ cl ] ) { var node = document . createElement ( 'script' ) ; var head = document . getElementsByTagName ( 'head' ) [ 0 ] || document . firstChild ; node . type = 'text/javascript' ; node . charset = 'utf-8' ; node . async = true ; node . src = baseUrl + _config . appRoot [ 1 ] + '/' + _classToFile ( cl ) + '.js' + ( _config . cache ? '?u=' + ( new Date ( ) ) . getTime ( ) : '' ) ; head . appendChild ( node ) ; _filesLoading ++ ; _loadClasses [ cl ] = ( new Date ( ) ) . getTime ( ) ; } } function loadClasses ( classes ) { var i ; var len ; var cl ; if ( classes ) { for ( i = 0 , len = classes . length ; i < len ; i ++ ) { cl = ns ( classes [ i ] , false ) ; if ( isFunction ( cl ) ) { loadClasses ( ns ( classes [ i ] , false ) . prototype . requires ) ; } else { insertScript ( classes [ i ] ) ; } } } } loadClasses ( isArray ( cl ) ? cl : [ cl ] ) ; if ( ! _filesLoading ) { _onLoadEnd ( ) ; } }
This is asynchronous files loader.
This is asynchronous files loader .
/**
         * @private
         * This method inserts specified class(file) into the DOM. It creates <script> tag for that.
         * It works only for our classes. For example it doesn't work for Backbone.Model or any third party classes.
         * @param {String} cl Name of the class
         */ /**
         * Loads classes recursively. It takes all dependencies and calls insertScript() for them. So all required
         * classes will be loaded.
         * @param {Array} classes Array of class names
         */ // // All scripts have already loaded //