Open wangbinyq opened 8 years ago
source code structure:
createNode
, removeNode
, setAttribute
, setProperty
, eventProxy
.diff.js
contains the most important part of preact, It include the diff algorithm. component.js
handle component (lifecycle) and the associated dom.https://medium.com/@rajaraodv/the-inner-workings-of-virtual-dom-666ee7ad47cf
angular.module('AModule', ['AnotherModule'])
var module = angular.module('AModule')
module.constant('aConstant', 42)
var injector = createInjector(['AModule'])
var c = injector.get('aConstant')
module.constant('a', 2)
module.constant('b', 40)
var fn = function (a , b) { return a + b } fn.$inject = ['a', 'b'] injector.invoke(fn) === 42
- invoke a function with local variables
- instantiating objects
```js
function Type (a, b) {
this.result = a + b
}
Type.$inject = ['a', 'b']
injector.instantiate(Type).result === 42
module.provider('a', {
$get: function () { return 42 }
})
injector.get('a') === 42
- provider can be injected?
```js
module.provider('b', {$get: function (a) { return a + 2} })
module.provider('a', {$get: function () { return 40 }}
injector.get('b') === 42
$get
method
Backbone