How browsers work?
瀏覽器運作方式是所有Web工程師的都需要了解的,可以幫助我們了解網頁背後做了什麼事
本篇會先以主流的瀏覽器來做討論
- Chrome
- Firefox
- Internet Explorer
- Safari
瀏覽器運作方式是所有Web工程師的都需要了解的,可以幫助我們了解網頁背後做了什麼事
本篇會先以主流的瀏覽器來做討論
之前完全沒使用過閉包的技巧,身為一個前端工程師,寫了這麼多年的code,到底什麼是閉包?就用這篇來記錄自己對於閉包這個名詞的解釋吧!主要會以我在網路上蒐集到關於閉包的文章加上自己的見解來寫,盡量白話一點解釋
首先,在MDN上對於閉包的解釋如下
A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.
中文是
閉包(Closure)是函式以及該函式被宣告時所在的作用域環境(lexical environment)的組合。
重新解釋一遍
當一個function被建立時,會儲存一組當下的作用域及function本身在記憶體中
1 | remote: No anonymous write access. |
1 | deploy: |
Each pattern describes a problem which occurs over and over again … and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without doing it the same way twice. @Christopher Alexander
目前有26種主要的設計模式,又可以分成三大類
In those systems, the subject is usually named a “stream of events” or “stream source of events”, while the observers are called “sinks of events”
觀察者模式,設定一個被觀察物件(subject),當subject的狀態變更時,觀察者也會有相對的行為,通常是用來處理事件,在此模式下被觀察物件會被稱為stream of events
指令 | 動作 | 備註 |
---|---|---|
hexo new “PostName” | 發布新文章 | |
hexo clean | 清空靜態檔緩存 | |
hexo server | Run server | Server |
hexo generate | Generate static files | 產生靜態檔,Generating |
hexo deploy | Deploy to remote sites | |
hexo build | 編譯 | |
hexo init | 初始化Hexo資料夾 | |
hexo -v | 確認版本 |