2017-02-24 1 views
0

아래는 namespace.js의 코드입니다. 여기에 많은 객체가있는 창 배열을 설정하십시오. 이제이 창 배열이 나온 곳에서. 그것이 설정된 곳.여기서 pimcore의 namespace.js에서 window array가 사용되도록 설정되어 있습니까?

/** 
    * Pimcore 
    * 
    * This source file is available under two different licenses: 
    * - GNU General Public License version 3 (GPLv3) 
    * - Pimcore Enterprise License (PEL) 
    * Full copyright and license information is available in 
    * LICENSE.md which is distributed with this source code. 
    * 
    * @copyright Copyright (c) 2009-2016 pimcore GmbH (http://www.pimcore.org) 
    * @license http://www.pimcore.org/license  GPLv3 and PEL 
    */ 

    if (!pimcore) { 
     var pimcore = {}; 
    } 


    pimcore.registerNS = function(namespace) { 
     var spaces = namespace.split("."); 
     console.log(window); 
     // create main space 
     if (typeof window[spaces[0]] != "object") { 
      window[spaces[0]] = {}; 
     } 
     var currentLevel = window[spaces[0]]; 

     // create all subspaces 
     for (var i = 1; i < (spaces.length - 1); i++) { 
      if (typeof currentLevel[spaces[i]] != "object") { 
       currentLevel[spaces[i]] = {}; 
      } 
      currentLevel = currentLevel[spaces[i]]; 
     } 
     return currentLevel; 
    }; 

이 코드에서 창은 설정되어 있습니까?

답변

0

이 JavaScript는 인터넷 브라우저 에서 실행됩니다. 인터넷 브라우저에서 JavaScript를 실행하면 여러 추가 API (Application Programming Interface) - Window Object 중 하나가 제공됩니다.

사실, 코드 스 니펫이 Pimcore Sources의 것이므로이 질문은 Pimcore와 전혀 관련이 없습니다.

관련 문제