forked from angular/angular
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(change detection): implement barebone ChangeDetector
fixes angular#39
- Loading branch information
Showing
7 changed files
with
193 additions
and
136 deletions.
There are no files selected for viewing
14 changes: 8 additions & 6 deletions
14
.../change_detection/src/change_detection.js → ...s/change_detection/src/change_detector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
library change_detection.facade; | ||
|
||
@MirrorsUsed(targets: const [FieldGetterFactory], metaTargets: const [] ) | ||
import 'dart:mirrors'; | ||
|
||
typedef SetterFn(Object obj, value); | ||
|
||
class FieldGetterFactory { | ||
getter(Object object, String name) { | ||
Symbol symbol = new Symbol(name); | ||
InstanceMirror instanceMirror = reflect(object); | ||
return (Object object) => instanceMirror.getField(symbol).reflectee; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
export var SetterFn = Function; | ||
|
||
export class FieldGetterFactory { | ||
getter(object, name:string) { | ||
return new Function('o', 'return o[' + name + ']'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.