久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='qlZFT'><style id='qlZFT'><dir id='qlZFT'><q id='qlZFT'></q></dir></style></legend>
        <bdo id='qlZFT'></bdo><ul id='qlZFT'></ul>
      <i id='qlZFT'><tr id='qlZFT'><dt id='qlZFT'><q id='qlZFT'><span id='qlZFT'><b id='qlZFT'><form id='qlZFT'><ins id='qlZFT'></ins><ul id='qlZFT'></ul><sub id='qlZFT'></sub></form><legend id='qlZFT'></legend><bdo id='qlZFT'><pre id='qlZFT'><center id='qlZFT'></center></pre></bdo></b><th id='qlZFT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qlZFT'><tfoot id='qlZFT'></tfoot><dl id='qlZFT'><fieldset id='qlZFT'></fieldset></dl></div>

      <small id='qlZFT'></small><noframes id='qlZFT'>

    1. <tfoot id='qlZFT'></tfoot>

      1. JavaScript 依賴管理

        JavaScript dependency management(JavaScript 依賴管理)
      2. <i id='1mDDP'><tr id='1mDDP'><dt id='1mDDP'><q id='1mDDP'><span id='1mDDP'><b id='1mDDP'><form id='1mDDP'><ins id='1mDDP'></ins><ul id='1mDDP'></ul><sub id='1mDDP'></sub></form><legend id='1mDDP'></legend><bdo id='1mDDP'><pre id='1mDDP'><center id='1mDDP'></center></pre></bdo></b><th id='1mDDP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1mDDP'><tfoot id='1mDDP'></tfoot><dl id='1mDDP'><fieldset id='1mDDP'></fieldset></dl></div>
          1. <tfoot id='1mDDP'></tfoot>
              <bdo id='1mDDP'></bdo><ul id='1mDDP'></ul>

              <small id='1mDDP'></small><noframes id='1mDDP'>

                <legend id='1mDDP'><style id='1mDDP'><dir id='1mDDP'><q id='1mDDP'></q></dir></style></legend>

                  <tbody id='1mDDP'></tbody>
                  本文介紹了JavaScript 依賴管理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我目前正在維護大量的 JS 文件,并且依賴問題越來越嚴重.現在我將每個函數放在一個單獨的文件中,并且我手動維護一個數據庫來計算函數之間的依賴關系.

                  I am currently maintaining a large number of JS files and the dependency issue is growing over my head. Right now I have each function in a separate file and I manually maintain a database to work out the dependencies between functions.

                  這我想自動化.例如,如果我有函數 f

                  This I would like to automate. For instance if I have the function f

                  Array.prototype.f = function() {};
                  

                  在另一個函數 g 中被引用

                  which is referenced in another function g

                  MyObject.g = function() {
                      var a = new Array();
                      a.f();
                  };
                  

                  我希望能夠檢測到 g 正在引用 f.

                  I want to be able to detect that g is referencing f.

                  我該怎么做?我從哪里開始?我是否需要實際編寫一個編譯器,或者我可以調整 Spidermonkey 嗎?其他人已經這樣做了嗎?

                  How do I go about this? Where do I start? Do I need to actually write a compiler or can I tweak Spidermonkey for instance? Did anyone else already do this?

                  非常感謝任何讓我入門的指針

                  Any pointers to get me started is very much appreciated

                  謝謝多克

                  推薦答案

                  雖然理論上你可以編寫一個靜態分析工具來檢測其他文件中定義的全局變量的使用,例如 MyObject 的使用,但你無法實際跟蹤 prototype 擴展方法的使用情況.

                  Whilst you could theoretically write a static analysis tool that detected use of globals defined in other files, such as use of MyObject, you couldn't realistically track usage of prototype extension methods.

                  JavaScript 是一種動態類型的語言,因此任何工具都無法知道 a,如果從 g 函數傳遞出來,是一個 Array,因此如果在其上調用 f(),則存在依賴關系.它只會在運行時確定哪些變量包含哪些類型,因此要找出您需要一個解釋器并且您已經讓自己成為一個圖靈完備的問題.

                  JavaScript is a dynamically-typed language so there's no practical way for any tool to know that a, if passed out of the g function, is an Array, and so if f() is called on it there's a dependency. It only gets determined what variables hold what types at run-time, so to find out you'd need an interpreter and you've made yourself a Turing-complete problem.

                  更不用說 JavaScript 的其他動態方面完全無視靜態分析,例如通過方括號表示法獲取屬性、可怕的 eval 或超時字符串或事件處理程序屬性.

                  Not to mention the other dynamic aspects of JavaScript that completely defy static analysis, such as fetching properties by square bracket notation, the dreaded eval, or strings in timeouts or event handler attributes.

                  我認為這真的有點不適合.您可能最好手動跟蹤依賴項,但通過將相關功能分組到模塊中來簡化它,這將是您的依賴項跟蹤的基本單元.好的,您將引入更多技術上需要的功能,但希望不要太多.

                  I think it's a bit of a non-starter really. You're probably better of tracking dependencies manually, but simplifying it by grouping related functions into modules which will be your basic unit of dependency tracking. OK, you'll pull in a few more functions that you technically need, but hopefully not too much.

                  為每個模塊命名也是一個好主意,因此每個調用的去向非常清晰,從而可以輕松地手動控制依賴關系(例如,通過 //使用:ThisModule, ThatModule 頂部注釋).

                  It's also a good idea to namespace each module, so it's very clear where each call is going, making it easy to keep the dependencies in control manually (eg. by a // uses: ThisModule, ThatModule comment at the top).

                  由于內置原型的擴展更難跟蹤,因此請將它們保持在最低限度.擴展例如.Array 在瀏覽器上包含 ECMAScript 第五版方法(如 indexOf)是一件好事,作為所有腳本都將使用的基本修復.向現有原型添加全新的任意功能是值得懷疑的.

                  Since extensions of the built-in prototypes are trickier to keep track of, keep them down to a bare minimum. Extending eg. Array to include the ECMAScript Fifth Edition methods (like indexOf) on browsers that don't already have them is a good thing to do as a basic fixup that all scripts will use. Adding completely new arbitrary functionality to existing prototypes is questionable.

                  這篇關于JavaScript 依賴管理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                      <tbody id='3Y8UL'></tbody>

                    • <i id='3Y8UL'><tr id='3Y8UL'><dt id='3Y8UL'><q id='3Y8UL'><span id='3Y8UL'><b id='3Y8UL'><form id='3Y8UL'><ins id='3Y8UL'></ins><ul id='3Y8UL'></ul><sub id='3Y8UL'></sub></form><legend id='3Y8UL'></legend><bdo id='3Y8UL'><pre id='3Y8UL'><center id='3Y8UL'></center></pre></bdo></b><th id='3Y8UL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3Y8UL'><tfoot id='3Y8UL'></tfoot><dl id='3Y8UL'><fieldset id='3Y8UL'></fieldset></dl></div>
                    • <small id='3Y8UL'></small><noframes id='3Y8UL'>

                      • <tfoot id='3Y8UL'></tfoot>
                          <bdo id='3Y8UL'></bdo><ul id='3Y8UL'></ul>

                          1. <legend id='3Y8UL'><style id='3Y8UL'><dir id='3Y8UL'><q id='3Y8UL'></q></dir></style></legend>
                            主站蜘蛛池模板: 国产91一区二区三区 | 亚洲欧美自拍偷拍视频 | 欧美日韩一区二区三区视频 | 日日操操操 | a级毛片免费高清视频 | 91精品国产综合久久久久久蜜臀 | 国产精品99久久久久久久vr | 久久综合av| 午夜伦理影院 | 国产日韩一区二区 | 91视频网| 龙珠z在线观看 | 天天艹日日干 | 狠狠婷婷综合久久久久久妖精 | 一区二区免费 | 97久久精品午夜一区二区 | 免费一区二区三区 | 天天色天天射天天干 | 中文字幕日韩一区二区 | 亚洲精品www| 在线日韩欧美 | 成人精品一区亚洲午夜久久久 | 国产精品久久久久永久免费观看 | 中文字幕视频在线 | 欧美成人免费在线 | 国产乱码精品一区二区三区五月婷 | 国产精品a久久久久 | 中文字幕日韩欧美 | 国产精品久久久亚洲 | 成人午夜精品一区二区三区 | 中文字幕 亚洲一区 | 天天操天天操 | 国产午夜精品理论片a大结局 | 四虎影院在线播放 | 日本一区二区不卡视频 | 精品国产欧美一区二区三区成人 | 日韩高清一区二区 | 97精品久久 | 成人免费视屏 | 在线观看国产视频 | 日韩av高清 |