Open ericltw opened 4 years ago
Decorator本質上是一個function,執行以下兩件事情:
key: value pair的集合
在JavaScript中,除了primitive types, 都是object。
包含array, function, objects。
object透過prototype關聯其他object。
幾乎每個object都會link到另一個object。
object自prototype ancestry繼承property和method。
prototype在object生成時會自動分配到object。
能夠定義object prototype。
Prototypes in JavaScript
https://medium.com/better-programming/prototypes-in-javascript-5bba2990e04b
JavaScript Question: What is a Prototype?
Matser JavaScript Prototypes & Inheritance
https://codeburst.io/master-javascript-prototypes-inheritance-d0a9a5a75c4e
Module
Module
module是可複用的代碼,封裝了實現的細節,公開API,因此可以被其他代碼加載和使用。
Module format
module format定義module的語法。在ES6釋出之後,JavaScript才有了原生定義module的語法,因此在ES6以前,有多種非原生定義module的語法,像是AMD, CommonJS, UMD, System.register。
Module loader
module loader在runtime解釋並加載以某種module format編寫的module,像是RequireJS, SystemJs。
Module bundler
module bundler取代module loader,module bundler在build time生成a bundle of all code,像是Browserify, Webpack。
Reference