鍍金池/ 問答/HTML/ 什么是`LS`, 什么是Electron呢?

什么是`LS`, 什么是Electron呢?

我在看代碼的時候:

// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  if (!r && typeof process !== 'undefined' && 'env' in process) {
    r = process.env.DEBUG;
  }

這句話怎么理解?

If debug isn't set in LS, and we're in Electron

什么是LS, 什么是Electron呢?

回答
編輯回答
野橘

electron官方描述是“Electron 基于 Chromium 和 Node.js, 讓你可以使用 HTML, CSS 和 JavaScript 構(gòu)建應(yīng)用。”也就是用前端技術(shù)寫桌面程序,比如vscode。
最簡單的,你寫幾個html頁面然后用Electron打包就可以得到一個桌面應(yīng)用程序。 不過使用Electron的話最好先了解部分nodejs知識,不然還不如用瀏覽器打開html。

LS你看下上下文。。。你這是debug.js的源碼,這里的LS指的是localstorage。

 function load() {
   var r;
   try {
    //給r賦值exports.storage.debug,exports.storage在代碼開始幾行定義
     r = exports.storage.debug;
   } catch(e) {}
  exports.storage = 'undefined' != typeof chrome
                 && 'undefined' != typeof chrome.storage
                    ? chrome.storage.local
                    : localstorage();

process、module.export這些都是和nodejs有關(guān)的概念,你如果不了解nodejs的話不建議你看這源碼。

2017年2月4日 19:11